glassfish
  1. glassfish
  2. GLASSFISH-18402

EJB lookup problem with webstart; multithreaded use of same client-side proxy?

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.2_b18, 3.1.2_b19, 3.1.2_b20, 3.1.2_b21, 3.1.2_b22, 3.1.2_b23
    • Fix Version/s: None
    • Component/s: orb
    • Labels:
      None

      Description

      Our enterprise application contains an EJB module and the application client. The remote jndi lookup in the application client works fine, if the client stub runs with the appclient shell script. But when the application is executed via webstart, the beans won't be located properly due to the following error:

      Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacede.beans.einkauf.MyServiceBeanRemote [Root exception is java.lang.IllegalArgumentException: java.lang.ClassCastException@532c81b7]
      	at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:434)
      	at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
      	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      	at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
      	at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
      	... 15 more
      Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@532c81b7
      	at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:422)
      	... 19 more
      

      Maybe a cache issue, but we have no clue what goes wrong here.

        Activity

        Hide
        Tim Quinn added a comment -

        I have a very simple client that I use for various manual tests. I modified it to create a new InitialContext and then
        use it to look up and use a stateless session bean.

        It gave me the buffer timeout warning Andreas reported the first time I ran it using Java Web Start, but that did not
        cause any class cast errors. And the next 7 times I ran it I saw no such warning.

        (I will attach my Java Web Start trace file.) I ran the same client several times using the appclient command and
        never saw the warning, but clearly that problem is intermittent so perhaps I was just lucky - or unlucky.

        By the way, I did not notice any delay at all during the run with the error.

        Show
        Tim Quinn added a comment - I have a very simple client that I use for various manual tests. I modified it to create a new InitialContext and then use it to look up and use a stateless session bean. It gave me the buffer timeout warning Andreas reported the first time I ran it using Java Web Start, but that did not cause any class cast errors. And the next 7 times I ran it I saw no such warning. (I will attach my Java Web Start trace file.) I ran the same client several times using the appclient command and never saw the warning, but clearly that problem is intermittent so perhaps I was just lucky - or unlucky. By the way, I did not notice any delay at all during the run with the error.
        Hide
        Tim Quinn added a comment -

        Attached Java Web Start trace of app client launch with ORB warning...but it completed successfully.

        Show
        Tim Quinn added a comment - Attached Java Web Start trace of app client launch with ORB warning...but it completed successfully.
        Hide
        andydr added a comment - - edited

        After a couple of code changes I assume the problem relates to
        asynchronous ejb access. Our swing gui loads during startup
        the data concurrently. Some EJBs are access from the main thread
        and other EJBs via the awt-event queue.

        I removed all new Thread(..) and SwingUtilitites.* parts and the startup
        works as expected. Is concurrent access of ejbs not supported?

        In a simple concurrent test I could reproduce the buffer timeout issue but
        not the classcast problem:

        for (int i = 0; i < 30; i++) {
           if (i % 2 == 0) {
             new Thread() {
        
               @Override
               public void run() {
                 ... execute ejb
               }
             }.start();
           } else {
             ... execute ejb
           }
        }
        
        Show
        andydr added a comment - - edited After a couple of code changes I assume the problem relates to asynchronous ejb access. Our swing gui loads during startup the data concurrently. Some EJBs are access from the main thread and other EJBs via the awt-event queue. I removed all new Thread(..) and SwingUtilitites.* parts and the startup works as expected. Is concurrent access of ejbs not supported? In a simple concurrent test I could reproduce the buffer timeout issue but not the classcast problem: for ( int i = 0; i < 30; i++) { if (i % 2 == 0) { new Thread () { @Override public void run() { ... execute ejb } }.start(); } else { ... execute ejb } }
        Hide
        Tim Quinn added a comment -

        Thanks for doing the additional investigation and posting your results.

        The EJB itself on the server side is (if I remember the spec correctly) is threadsafe,
        but the layers on the client side (the ORB particularly) could be a different matter entirely.

        Harshad will know more, but from your findings it seems that using the same client-side
        proxy from multiple threads is triggering the problem.

        Show
        Tim Quinn added a comment - Thanks for doing the additional investigation and posting your results. The EJB itself on the server side is (if I remember the spec correctly) is threadsafe, but the layers on the client side (the ORB particularly) could be a different matter entirely. Harshad will know more, but from your findings it seems that using the same client-side proxy from multiple threads is triggering the problem.
        Hide
        Tim Quinn added a comment -

        based on the latest information from Andreas I have added to the title of this issue and am transferring it to the ORB component.

        I am not sure whether this is a bug or whether the use of a single EJB proxy from multiple threads is unsupported, but Harshad is the right person to answer.

        Show
        Tim Quinn added a comment - based on the latest information from Andreas I have added to the title of this issue and am transferring it to the ORB component. I am not sure whether this is a bug or whether the use of a single EJB proxy from multiple threads is unsupported, but Harshad is the right person to answer.

          People

          • Assignee:
            Harshad Vilekar
            Reporter:
            andydr
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: