0 Replies Latest reply on Mar 2, 2005 2:52 PM by Alliant Energy EAI Integration Services

    Fix for a JNDI error I had with deploying examples

    Alliant Energy EAI Integration Services Newbie

      Hi-- first post to this forum, hope everyone is well. I'm a noob, so bear with me.

      So, for the past couple of days I've been having a tough time installing JBoss 4.0 and going through the examples (JBoss tutorial V3, Sun tutorial V4). But I figured out the problem, and I'd like to share it with everyone.

      When I installed JBoss from scratch (onto a Windows 2000 machine) into a default directory ("C:\jboss-4.0.1sp1") and simply started it up, it would not boot up correctly. Error I would get was something like

      2005-03-02 13:10:12,124 ERROR [org.jboss.naming.NamingService] Could not start on port 1099
      java.net.BindException: Address already in use: JVM_Bind



      On my machine, apparently some other app is using the 1099 port, therefore blocking the JNDI Naming Service from properly operating. So using a fix I found in other posts on this forum, in the {JBOSS_HOME}\jboss-4.0.1sp1\server\{configuration}\conf directory, edited jboss-service.xml

       <mbean code="org.jboss.naming.NamingService"
       name="jboss:service=Naming"
       xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
       <!-- The call by value mode. true if all lookups are unmarshalled using
       the caller's TCL, false if in VM lookups return the value by reference.
       -->
       <attribute name="CallByValue">false</attribute>
       <!-- The listening port for the bootstrap JNP service. Set this to -1
       to run the NamingService without the JNP invoker listening port.
       -->
       <!--<attribute name="Port">1099</attribute> this is the original, my modified below-->
       <attribute name="Port">2099</attribute>



      To another port that was unused, say 2099. (Use "netstat -a" command in a DOS prompt window to make see what ports your machine is using at any given moment, pick an open one). This allowed JBoss to start in a normal way. However, I still couldn't run any of the examples (Duke's Bank, SimpleMessage) in the JBoss tutorial. Here's the symptoms of the problem:

      Deployed the Sun J2EE Tutorial and the JBoss overlay exactly according to the instructions, built them properly, but whenever I deployed the apps into JBoss, nothing would happen. JBoss would start to deploy the beans, but then just hang. Deleting the jar wouldn't do anything, and the log files were useless. Here's where the Duke's Bank app would stop...

      13:18:10,602 INFO [EjbModule] Deploying CustomerBean
      13:18:10,672 INFO [EjbModule] Deploying AccountBean
      13:18:10,682 INFO [EjbModule] Deploying TxBean
      13:18:10,692 INFO [EjbModule] Deploying NextIdBean
      13:18:10,692 INFO [EjbModule] Deploying AccountControllerBean
      13:18:10,732 INFO [EjbModule] Deploying CustomerControllerBean
      13:18:10,742 INFO [EjbModule] Deploying TxControllerBean


      I'm not going to post the log file (unless someone wants me to), but they don't say much as far as what the problem is/was. But I had to hard kill the server every time to get out of it. Was completely locked and unresponsive.

      Took me forever to figure it out (because I'm pretty dumb with this stuff), but here's the fix: Within each compiled example, a jndi.properties file is bundled in each deployable .ear. (for example, the SimpleMessage jndi.properties file is in the C:\j2eetutorial14\examples\ejb\simplemessage\dd\ directory on my machine).

      Once I changed the naming.provider.url port to point to the same one as I configured in jboss-service.xml, rebuilt, redeployed, and everything works fine. For example,

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      # java.naming.provider.url=jnp://localhost:1099 original line, my modified below
      java.naming.provider.url=jnp://localhost:2099
      java.naming.factory.url.pkgs=org.jboss.naming.client
      j2ee.clientName=SimpleMessageClient


      Bottom line, if you change a config setting somewhere once, make sure it gets changed EVERYWHERE.

      Hope that this helps someone someday. I sure beat my head on a wall many times and nearly gave up on JBoss trying to get these ^%$*%^$# examples to work. That new tutorial will be a welcome sight for noobs like me.