1 Reply Latest reply on Nov 27, 2007 6:20 AM by Norbert Lotter

    Failed to run example 'queue' from an Eclipse project

    Norbert Lotter Newbie

      I have installed JBoss 4.2.1 GA and JBoss Messaging 1.4.0 SP1 on a Windows XP System. Since port 8080 is blocked on my system, I had to configure the webserver to listen to port 9080.

      I first ran the example 'queue' from the console and it works fine.

      Then I tried to build a Java project in Eclipse from the example files. I included the following libraries in the project:
      javassist.jar
      jbossall-client.jar
      jboss-aop-jdk50.jar
      jboss-messaging-client.jar
      jboss-remoting.jar
      log4j.jar
      trove.jar
      jboss-j2ee.jar

      These are the ones referenced from the build.xml file. I am using a JRE 1.5 , which is installed correctly, since it works with a lot of other projects.

      When I try to run the example, I get the following stack trace:

      java.lang.Error: Can't find java.home ??
      at sun.net.NetProperties.loadDefaultProperties(NetProperties.java:45)
      at sun.net.NetProperties.access$000(NetProperties.java:24)
      at sun.net.NetProperties$1.run(NetProperties.java:30)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.net.NetProperties.(NetProperties.java:27)
      at sun.net.spi.DefaultProxySelector$1.run(DefaultProxySelector.java:70)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.net.spi.DefaultProxySelector.(DefaultProxySelector.java:67)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:164)
      at java.net.ProxySelector.(ProxySelector.java:51)
      at java.net.SocksSocketImpl$5.run(SocksSocketImpl.java:331)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
      at java.net.Socket.connect(Socket.java:519)
      at java.net.Socket.connect(Socket.java:469)
      at java.net.Socket.(Socket.java:366)
      at java.net.Socket.(Socket.java:266)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1387)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:596)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.example.jms.common.Util.doesDestinationExist(Util.java:55)
      at org.jboss.example.jms.common.ExampleSupport.setup(ExampleSupport.java:220)
      at org.jboss.example.jms.common.ExampleSupport.setup(ExampleSupport.java:194)
      at org.jboss.example.jms.common.ExampleSupport.run(ExampleSupport.java:146)
      at org.jboss.example.jms.queue.QueueExample.main(QueueExample.java:134)

      #####################
      ### FAILURE! ###
      #####################

      Obviously the test program fails to create the initial naming context for "/queue/testQueue".

      I searched the internet and found a hint that this error may be caused by a misspelled host name or port id. It seems to me that some configuration information (e.g. from a properties-file) is not set or read correctly in the Eclipse project. I do read the jndi.properties file explicitly, which is still as it was when I unpacked it.

      Can someone give me a hint where my mistake lies?

      Regards
      Norbert

        • 1. Re: Failed to run example 'queue' from an Eclipse project
          Norbert Lotter Newbie

          I found out that the error was caused by missing config parameters for the InitialContext that was used. Though I had set the parameters correctly for the contexts I created explicitly, the ones that were created by the static utility routines of the example files were not initialized. This was because my run environment was not exactly as the one used for examples when running them with ant and thus the config files (like jndi.properties) were not found.

          After I made sure that for all InitialContexts that were used, the configuration was set properly, it worked.