EJB programming & troubleshooting: Problem looking up EJBs in BES 5.0

  1. Problem looking up EJBs in BES 5.0 (5 messages)

    Hi at all,
    I got a simple EJB deployed in BES5.0
    When running a test client from JBuilder6 IDE, the first attempt looking up the bean works fine - everything is working. When I run the client again for a second and a third time, I get the following error message:

    javax.naming.NameNotFoundException. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound

    4th attempt was succesful again.
    This happens whether I use the embedded server in JBuilder or the deployed EJB in the standalone server.
    What's going on there? Any ideas? The name is correct, otherways 1st and 4th attempt would have been failed, too.

    Is this a bug in BES5.0?

    Thx, Thomas
  2. Thomas,

    Its not a bug a BES but the product's load-balancing features kicking in when you start clustering.

    In short, you are running multiple Containers (probably different developers running their own server instances) within the same subnet on the same port (default 14000). In this case, when your client start's up it locates a server on a round-robin based algorithm. If the server does not contain your EJBs, your client will get an exception. Which is what you are seeing.

    The solution is to assign a different osagent ports to different developers. And that port number would be passed as JVM parameter to the client applications. Note that this requires absolutely no recoding to either your client or server applications.

    To get an idea of how clustering works in our product, see:

    On a related note, I'd suggest moving to version 5.0.2 of the product (available for download) since there have been numerous enhancements since the 5.0.0 version. The same license keys should be usable.

  3. Krish,

    thanx for your tips, but it doesn't work. I changed to port number of osagent to 14050. Passed the new port number to the client via the -Dvbroker.agent.port=14050 option. Now I'm completely unable to find any of my EJBs. Everytime I call the client I get a
    org.omg.CORBA.OBJECT_NOT_EXIST: minor code: 0 completed: No

    exception. Is there anything else I have to change?
    Seems in my subnet are no other BES....

    Thanx, Thomas
  4. Sorry, Krish,

    I wrote 1450 instead of 14050.. :-(
    Now I get the same errors as described in my first posting in this thread. Sometimes it works, sometimes I get a

    I use the standalone BES Server, but the project I am developing is not deployed to the standalone server. JBuilder starts the internal container (the partition name is 'standard') when I select "Run project". Is this 'standard'-partition the same than in the standalone server? I found out that I have to start the standalone server - otherwise the internal container cannot initialize the JNS.

    I'm a bit confused at the moment - lots of questions, no answers....

    Thnx for your help, Thmas
  5. Thomas,

    First of all, you do not need to run the full-fledged server just because the JNS is not initializing. The reason for the above is that you need an OSAgent running on the same port before starting up the Container. So, the steps you'd have to follow are:

    (1) Go to: "Tools" --> "Enterprise Setup", "CORBA" tab and
         set the OSAgent as 14050 (or whatever).
    (2) Before starting up the Container, go to the "Tools" -->
         "VisiBroker Smart Agent". This runs the OSAgent which
         should then appear in your system tray. (on the port
         specified in step 1)
    (3) Start up the Container. Ensure that the Container uses
         the same port number from step 1. This can be done by:
         "Project" --> "Project Properties" --> "Run" tab,
         "EJB" sub-tab, and then adding the VM param:
    (4) Start up the client. Ensure that the Client uses the
        same port number as well. This can be done by:
        "Project" --> "Project Properties" --> "Run" tab,
         "Application" sub-tab, and then adding the VM param:

    All the above steps need not be repeated if you set them under "Default Project Properties" under JBuilder. Subsequent projects created will use the above settings. If you use JSPs/Servlets, you'd have the set the JVM param mentioned in Step (4) under the "JSP/Servlet" sub-tab under the "Run" tab. So, all that it boils down to is: starting the OSAgent (Smart Agent) prior to starting up the Container within JBuilder.

  6. Krish,
    thanx for your help, everything's doing fine!