1 Reply Latest reply on Sep 17, 2002 5:45 PM by rockinryan

    RE: Do JBoss and Tomcat share same VM - other thread is hose

    rockinryan

      Thanks Adrian for your reply,

      I confirmed that I was using a clean InitialContext, so long as this is the same then we are on the same page:
      jndiContext = new javax.naming.InitialContext();

      I did try the unwrapping technique per your advice but wasn't sure how to get through several layers. I feel like the stack trace is offering enough info already so I didn't fight to unwrap repeatedly. The reason for my original post and it's lack of code or stack trace is that I don't understand why rmi is involved when using local interfaces.

      A heavily trimmed stack looks like this:

      [BEGIN STACK]
      javax.ejb.EJBException: Undeclared throwable after one unwrap:
      Embedded Exception: null
      Embedded Exception
      $Proxy72; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception: $Proxy72
      at com.rydel.fys.UserSessionBean.isUseridAvailable(UserSessionBean.java:441)
      [HUGE SNIP]

      java.rmi.ServerException: null
      Embedded Exception
      $Proxy72; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      $Proxy72
      javax.ejb.EJBException: null
      Embedded Exception
      $Proxy72
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1148)
      [HUGE SNIP]

      java.lang.ClassCastException: $Proxy72
      at com.rydel.fys.UserBean$Proxy.ejbSelectTempUserByUserid()
      [END STACK]


      I just debugged deeper into my beans to find that I am unable to load a CMP2.0 entity bean. (My test client can create them no problem.) The code all executes fine if there is no matching data, but when I lookup an existing PK blam! As the stack indicates, the root of the problem appears to be a bad type cast, but I don't understand two things:

      1- Why am I getting any error in my stack via java.rmi.* when all my beans are local (and don't even have remote interfaces)?

      2- I'm using the Object type and not accessing any methods on the object (which is an existing entity bean) so I don't see why there'd be any casting issues.


      The cast that is failing is here:
      Object tempU = (Object)ejbSelectTempUserByUserid(userid);

      Declaration for my select method and it's EJB QL:
      public abstract UserBean ejbSelectTempUserByUserid(String userid) throws FinderException ;
      EJB QL: SELECT OBJECT(u) FROM User as u WHERE u.userid = ?1

      I will continue searching and repost if I get a handle on this. Thanks for your time, it is greatly appreciated.
      Ryan

        • 1. I found the cause of the exception
          rockinryan

          If you look at my few lines of code you'll see that I was expecting a bean class back from my select method:
          public abstract UserBean ejbSelectTempUserByUserid(String userid) throws FinderException ;
          What should have been there was a LOCAL bean. For some reason the "bean class" was offered in JBuilder's droplist when I created the method and I chose it. Once I switched the method declarations to UserLocal and adjusted dependent code everything worked and made sense. The cast error was happening internally in generated code (which is why my (Object) cast had nothing to do with it). I found it by adding debug statements in the entity bean interface methods. As soon as I found that the bean wasn't being created I knew the problem was between my code and the generator.

          Painful lessons, but I'm learning.

          Thank you so much for helping. (Even if I weren't such a 'tard) the answer to the shared VM was something I needed to know.
          Ryan