I have got an interesting case here which, in my view, illustrates the
need for a pluggable compiler architecture in the NetRexx translator, and maybe a bugfix in the current setup of the compiler classpath by NetRexxC. I am writing an WebSphere MQ Pub/Sub program using the MQ Java (not:JMS) API in NetRexx. I have a case in which the javac invoked by NetRexx gives errors, while a separate javac step compiles cleanly. I only found out because I am running in a Linux VM where I do not use my normal makefile that calls the Eclipse compiler. In short, I receive a complaint that "Class javax.resource.spi.ConnectionManager not found in new." The odd thing is, I don't use that class anywhere in my source, and consequently, neither does it turn up in the generated Java source. It must be a dependency of the MQ Java classes. After a quick google for the error, I found this on IBM's MQ pages: https://www-304.ibm.com/support/docview.wss?uid=swg21268822 (I include some of its content here for quick reference) -- snip -- Problem(Abstract) You are trying to build a Java™ application which uses the WebSphere MQ Java or JMS classes, but it will not compile due to missing classes or packages. You confirmed your classpath is correct or used the setjmsenv script to set the CLASSPATH variable for you, but you still see errors like these: --snip-- verbosity, but my same error --snip-- Cause The WebSphere MQ 6.0 jar files are built so that their dependencies will be resolved automatically. You only need to add the com.ibm.mq.jar or com.ibm.mqjms.jar file to your classpath in order to run a WebSphere MQ Java or JMS application, respectively, while WebSphere MQ 5.3 required several other classpath entries such as connector.jar or jms.jar. Historically only the java command has automatically found jar file dependencies. Other SDK tools like javac have required all of the dependencies to be included in the classpath. This restriction has been lifted in Java 5, as documented on the Sun Developer Network site. Resolving the problem If you are compiling WebSphere MQ Java or JMS applications using pre-Java 5 SDK, you will need to add WebSphere MQ dependencies to your classpath in order to compile, but not run, applications. These dependencies are documented in the WebSphere MQ 5.3 manuals. -- snip -- Note that this is quite old (2007); I am running with Java 1.7.02 and MQ 7.0.1 on CentOS 6.2, with NetRexx 3.01 RC3, but I encounter this problem; it is solved *without changing the compile classpath* when running javac as a separate step on the -keepasjava output. Note that NetRexxC executes correctly and I get the 'javac failed' message from the translator. While this stresses the needs for an easy way to specify the compiler (without having to do this in ant or make build specifications), it might be the case that this needs to be fixed in the translator itself. This also fails on the after-3.01 branch, and so has nothing to do with recent changes in this realm. Any thoughts? I will draft a proposal for compiler pluggability as a short-term measure. best regards, René Jansen. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
René -
This sounds suspiciously like one of the problems found by Marc when he was testing the LOOP OVER primitive arrays bug. See my last update note on that problem for more details but it seems that the legacy interface used by NetRexxC to call the Java compiler restricts the compiler to Java 1.4 features for some reason. Perhaps we should be passing an option "-source 1.5" to the Java compiler. Can you run your separate Java compile step test with the "-source 1.4" option to see if the problem is also there? -- Kermit On 2/2/2012 7:31 AM, rvjansen wrote: > I have got an interesting case here which, in my view, illustrates the > need for a pluggable compiler architecture in the NetRexx translator, > and maybe a bugfix in the current setup of the compiler classpath by > NetRexxC. I am writing an WebSphere MQ Pub/Sub program using the MQ > Java (not:JMS) API in NetRexx. I have a case in which the javac > invoked by NetRexx gives errors, while a separate javac step compiles > cleanly. I only found out because I am running in a Linux VM where I > do not use my normal makefile that calls the Eclipse compiler. > > In short, I receive a complaint that "Class > javax.resource.spi.ConnectionManager not found in new." The odd thing > is, I don't use that class anywhere in my source, and consequently, > neither does it turn up in the generated Java source. It must be a > dependency of the MQ Java classes. > > After a quick google for the error, I found this on IBM's MQ pages: > > https://www-304.ibm.com/support/docview.wss?uid=swg21268822 > > (I include some of its content here for quick reference) > > -- snip -- > Problem(Abstract) > > You are trying to build a Java™ application which uses the WebSphere > MQ Java or JMS classes, but it will not compile due to missing classes > or packages. You confirmed your classpath is correct or used the > setjmsenv script to set the CLASSPATH variable for you, but you still > see errors like these: --snip-- verbosity, but my same error --snip-- > > Cause > The WebSphere MQ 6.0 jar files are built so that their dependencies > will be resolved automatically. You only need to add the > com.ibm.mq.jar or com.ibm.mqjms.jar file to your classpath in order to > run a WebSphere MQ Java or JMS application, respectively, while > WebSphere MQ 5.3 required several other classpath entries such as > connector.jar or jms.jar. > > Historically only the java command has automatically found jar file > dependencies. Other SDK tools like javac have required all of the > dependencies to be included in the classpath. This restriction has > been lifted in Java 5, as documented on the Sun Developer Network site. > > Resolving the problem > If you are compiling WebSphere MQ Java or JMS applications using > pre-Java 5 SDK, you will need to add WebSphere MQ dependencies to your > classpath in order to compile, but not run, applications. These > dependencies are documented in the WebSphere MQ 5.3 manuals. > -- snip -- > > Note that this is quite old (2007); I am running with Java 1.7.02 and > MQ 7.0.1 on CentOS 6.2, with NetRexx 3.01 RC3, but I encounter this > problem; it is solved *without changing the compile classpath* when > running javac as a separate step on the -keepasjava output. Note that > NetRexxC executes correctly and I get the 'javac failed' message from > the translator. While this stresses the needs for an easy way to > specify the compiler (without having to do this in ant or make build > specifications), it might be the case that this needs to be fixed in > the translator itself. This also fails on the after-3.01 branch, and > so has nothing to do with recent changes in this realm. > > Any thoughts? I will draft a proposal for compiler pluggability as a > short-term measure. > > best regards, > > René Jansen. > > > > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > > > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Kermit,
it makes no difference. javac compiles the source without error, even with -source 1.4; the problem is the case that is explained here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212732 - a bug submitted in 1999: javac seems to ignore classpath manifest entries in jar files, indeed fixed in 1.5; but the -source 1.4 option does not seem to revert javac to the old way. In RxTranslator I see a classpath being fed to the compiler with the -cp, but I cannot see why this way it should ignore the manifest entries. This might need some study into the workings of the java compiler. I'll try to make a reproducible testcase. best regards, René. On 2 feb. 2012, at 20:02, Kermit Kiser wrote: > René - > > This sounds suspiciously like one of the problems found by Marc when he was testing the LOOP OVER primitive arrays bug. See my last update note on that problem for more details but it seems that the legacy interface used by NetRexxC to call the Java compiler restricts the compiler to Java 1.4 features for some reason. Perhaps we should be passing an option "-source 1.5" to the Java compiler. Can you run your separate Java compile step test with the "-source 1.4" option to see if the problem is also there? > > -- Kermit > > On 2/2/2012 7:31 AM, rvjansen wrote: >> I have got an interesting case here which, in my view, illustrates the need for a pluggable compiler architecture in the NetRexx translator, and maybe a bugfix in the current setup of the compiler classpath by NetRexxC. I am writing an WebSphere MQ Pub/Sub program using the MQ Java (not:JMS) API in NetRexx. I have a case in which the javac invoked by NetRexx gives errors, while a separate javac step compiles cleanly. I only found out because I am running in a Linux VM where I do not use my normal makefile that calls the Eclipse compiler. >> >> In short, I receive a complaint that "Class javax.resource.spi.ConnectionManager not found in new." The odd thing is, I don't use that class anywhere in my source, and consequently, neither does it turn up in the generated Java source. It must be a dependency of the MQ Java classes. >> >> After a quick google for the error, I found this on IBM's MQ pages: >> >> https://www-304.ibm.com/support/docview.wss?uid=swg21268822 >> >> (I include some of its content here for quick reference) >> >> -- snip -- >> Problem(Abstract) >> >> You are trying to build a Java™ application which uses the WebSphere MQ Java or JMS classes, but it will not compile due to missing classes or packages. You confirmed your classpath is correct or used the setjmsenv script to set the CLASSPATH variable for you, but you still see errors like these: --snip-- verbosity, but my same error --snip-- >> >> Cause >> The WebSphere MQ 6.0 jar files are built so that their dependencies will be resolved automatically. You only need to add the com.ibm.mq.jar or com.ibm.mqjms.jar file to your classpath in order to run a WebSphere MQ Java or JMS application, respectively, while WebSphere MQ 5.3 required several other classpath entries such as connector.jar or jms.jar. >> >> Historically only the java command has automatically found jar file dependencies. Other SDK tools like javac have required all of the dependencies to be included in the classpath. This restriction has been lifted in Java 5, as documented on the Sun Developer Network site. >> >> Resolving the problem >> If you are compiling WebSphere MQ Java or JMS applications using pre-Java 5 SDK, you will need to add WebSphere MQ dependencies to your classpath in order to compile, but not run, applications. These dependencies are documented in the WebSphere MQ 5.3 manuals. >> -- snip -- >> >> Note that this is quite old (2007); I am running with Java 1.7.02 and MQ 7.0.1 on CentOS 6.2, with NetRexx 3.01 RC3, but I encounter this problem; it is solved *without changing the compile classpath* when running javac as a separate step on the -keepasjava output. Note that NetRexxC executes correctly and I get the 'javac failed' message from the translator. While this stresses the needs for an easy way to specify the compiler (without having to do this in ant or make build specifications), it might be the case that this needs to be fixed in the translator itself. This also fails on the after-3.01 branch, and so has nothing to do with recent changes in this realm. >> >> Any thoughts? I will draft a proposal for compiler pluggability as a short-term measure. >> >> best regards, >> >> René Jansen. >> >> >> >> >> >> >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ >> >> >> > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by rvjansen
René,
If possible, I'd love to see some samples/examples of NetRexx/MQ code. MQ on Android with NetRexx? Why not! Peter Sharp Ballarat Australia From: rvjansen <[hidden email]> To: IBM Netrexx <[hidden email]> Date: 03/02/2012 02:36 Subject: [Ibm-netrexx] javac compiles but misses classes when invoked by NetRexxC Sent by: [hidden email] I have got an interesting case here which, in my view, illustrates the need for a pluggable compiler architecture in the NetRexx translator, and maybe a bugfix in the current setup of the compiler classpath by NetRexxC. I am writing an WebSphere MQ Pub/Sub program using the MQ Java (not:JMS) API in NetRexx. I have a case in which the javac invoked by NetRexx gives errors, while a separate javac step compiles cleanly. I only found out because I am running in a Linux VM where I do not use my normal makefile that calls the Eclipse compiler. In short, I receive a complaint that "Class javax.resource.spi.ConnectionManager not found in new." The odd thing is, I don't use that class anywhere in my source, and consequently, neither does it turn up in the generated Java source. It must be a dependency of the MQ Java classes. After a quick google for the error, I found this on IBM's MQ pages: https://www-304.ibm.com/support/docview.wss?uid=swg21268822 (I include some of its content here for quick reference) -- snip -- Problem(Abstract) You are trying to build a Java™ application which uses the WebSphere MQ Java or JMS classes, but it will not compile due to missing classes or packages. You confirmed your classpath is correct or used the setjmsenv script to set the CLASSPATH variable for you, but you still see errors like these: --snip-- verbosity, but my same error --snip-- Cause The WebSphere MQ 6.0 jar files are built so that their dependencies will be resolved automatically. You only need to add the com.ibm.mq.jar or com.ibm.mqjms.jar file to your classpath in order to run a WebSphere MQ Java or JMS application, respectively, while WebSphere MQ 5.3 required several other classpath entries such as connector.jar or jms.jar. Historically only the java command has automatically found jar file dependencies. Other SDK tools like javac have required all of the dependencies to be included in the classpath. This restriction has been lifted in Java 5, as documented on the Sun Developer Network site. Resolving the problem If you are compiling WebSphere MQ Java or JMS applications using pre-Java 5 SDK, you will need to add WebSphere MQ dependencies to your classpath in order to compile, but not run, applications. These dependencies are documented in the WebSphere MQ 5.3 manuals. -- snip -- Note that this is quite old (2007); I am running with Java 1.7.02 and MQ 7.0.1 on CentOS 6.2, with NetRexx 3.01 RC3, but I encounter this problem; it is solved *without changing the compile classpath* when running javac as a separate step on the -keepasjava output. Note that NetRexxC executes correctly and I get the 'javac failed' message from the translator. While this stresses the needs for an easy way to specify the compiler (without having to do this in ant or make build specifications), it might be the case that this needs to be fixed in the translator itself. This also fails on the after-3.01 branch, and so has nothing to do with recent changes in this realm. Any thoughts? I will draft a proposal for compiler pluggability as a short-term measure. best regards, René Jansen. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Hi Peter,
here is (the gist of) the MQ Java sample in netrexx; -- snip -- import com.ibm.mq.MQException import com.ibm.mq.MQGetMessageOptions import com.ibm.mq.MQMessage import com.ibm.mq.MQPutMessageOptions import com.ibm.mq.MQQueue import com.ibm.mq.MQQueueManager import com.ibm.mq.constants.MQConstants class MQSample properties private qManager = "rjtestqm"; qName = "SYSTEM.DEFAULT.LOCAL.QUEUE" method main(args=String[]) static binary m = MQSample() do say "Connecting to queue manager: " m.qManager qMgr = MQQueueManager(m.qManager) openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT say "Accessing queue: " m.qName queue = qMgr.accessQueue(m.qName, openOptions) msg = MQMessage() msg.writeUTF("Hello, World!") pmo = MQPutMessageOptions() say "Sending a message..." queue.put(msg, pmo) rcvMessage = MQMessage() gmo = MQGetMessageOptions() say "...and getting the message back again" queue.get(rcvMessage, gmo) msgText = rcvMessage.readUTF() say "The message is: " msgText say "Closing the queue" queue.close() say "Disconnecting from the Queue Manager" qMgr.disconnect() say "Done!" catch ex=MQException say "A WebSphere MQ Error occured : Completion Code " ex.completionCode "Reason Code " ex.reasonCode catch ex2=java.io.IOException say "An IOException occured whilst writing to the message buffer: " ex2 end -- snip -- Note that this uses the MQ Java API and not the MQ JMS API, which would be another valid choice in the JVM environment. This also uses bindings mode and serves as a sample to connect to queue manager 'rjtestqm' on the local machine. To use it in client mode, channel info should be added. Note the 'binary' signature on method main() - this is to get the bit masks for the option flags right. I intend to publish more about this, possibly at the next RexxLA Rexx Language Symposium (pencil into your calendars: May 14-16, Raleigh-Durham area, US), but I am currently busy to locate and shoot some bugs that were uncovered in (currently unreleased) new versions of NetRexx. So standby - although specific issues are probably worth mentioning on the list). best regards, René Jansen. On 2012-02-03 05:13, Peter Sharp wrote: > René, > If possible, I'd love to see some samples/examples of NetRexx/MQ > code. > MQ on Android with NetRexx? Why not! > > Peter Sharp > Ballarat Australia > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |