SOS!!! EJB client problem. Thanks in advance


EJB programming & troubleshooting: SOS!!! EJB client problem. Thanks in advance

  1. SOS!!! EJB client problem. Thanks in advance (2 messages)

    Hi All,

      I've spent a whole week and still have little clue to solve this problem. Sorry I have to write a lot to describe it clearly.
      This is a stand alone java application that will use several EJBs deployed in WebSphere3.5 on NT machine. It runs well on an NT machine (using either java or jre come with WebSphere3.5) but fails if I run it from an AIX machine (using IBM JRE 1.2.2)to access the same NT server.

    Here is the code piece:

    String providerURL = "iiop://";
    String initCtxtFactory = "";

    Properties namingProps = new Properties();
    namingProps.put(javax.naming.Context.PROVIDER_URL, providerURL);
    InitialContext initContext = null;

    // Create an Initial Context.
    try {
    System.out.println("providerURL="+ providerURL+";factory=" + initCtxtFactory);
    initContext = new InitialContext(namingProps);
    catch (javax.naming.NamingException ne) {
    System.err.println ("Could not retrieve initial context - all EJB lookups will fail." + ne.getMessage());

    NamingEnumeration nu = null;

    try {
    nu = initContext.list(s);
    }// Add this to see if it can retrieve JNDI names
    catch (NotContextException e) {
    System.out.println("point 1.");

    When I run it from AIX I got:
    at javax.naming.InitialContext.list(
    at com.tomax.distributedservices.AixScheduler.<init>(
    at com.tomax.distributedservices.AixScheduler.main(
    Exception in thread "P=838303:O=0:CT" java.lang.NullPointerException
    at com.tomax.distributedservices.AixScheduler.<init>(
    at com.tomax.distributedservices.AixScheduler.main(

    If I try to lookup the EJB directly (comment out list(s)) I get:
    javax.naming.NamingException: Error during resolve. Root exception is java.lang
    at javax.naming.InitialContext.lookup(
    at com.tomax.distributedservices.AixScheduler.<init>(
    at com.tomax.distributedservices.AixScheduler.main(

      Interestingly, if I use com.sun.jndi.cosnaming.CNCtxFactory to replace, it still works well on NT machine, and it finds the needed EJBs even from the AIX machine now. But whenever I call a EJB method that has a class object as parameter (implements Serializable), the following error message is thrown:

    org.omg.CORBA.MARSHAL: minor code: 0 completed: No
            at java.lang.Class.newInstance0(Native Method)
            at java.lang.Class.newInstance(
            at com.sun.rmi.iiop.ReplyMessage.getSystemException(
            at com.sun.rmi.iiop.ClientResponseImpl.getSystemException(ClientResponse
            at com.sun.rmi.corba.ClientDelegate.invoke(
            at org.omg.CORBA.portable.ObjectImpl._invoke(
            at com.tomax.wfm.ejb.schedule._SiteResourceRequest_BaseStub.isRequestCan
            at com.tomax.wfm.ejb.schedule._SiteResourceRequest_Stub.isRequestCancell
            at com.tomax.distributedservices.AixScheduler.isCancelled(AixScheduler.j
            at com.tomax.distributedservices.AixScheduler.foreverRun(AixScheduler.ja
            at com.tomax.distributedservices.AixScheduler.main(

      The thing is: The code is exactly the same but behaves differently. I read that we need IBM's JDK to talk to WebSphere but it also worked when I use Sun's context factory.

      I will be truly appreciative for any comments.

  2. Hi

    Have u included the client jar file in ur classpath when ur calling it from the AIX based machine.

    Try putting it in the classpath.

  3. Have you considered how the WebSphere classpaths tiers work?

    JVM classpath
    EJB classpath
    Web Application classpath

    Check this out -
    WebSphere Classpaths