2 Replies Latest reply on Mar 29, 2011 4:29 AM by Mitja Skuhala

    ERROR:Could not dereference object

    Mitja Skuhala Newbie

      I'm using jboss 6.0 Final and got this error when i'm try to lookup an object. I'm Deploying like EAR  (xxx.EAR) whitch icludes xxx.JAR. (At jboss 5.1 wokred this fine without errors).

       

      When i'm deploying like xxx.JAR works fine.

       

      Is this some bug or somthing?

      It look's like that at ear could not get acces to interface.

      Somebody gime some advice hot to manage this. Becouse i realy need to deploy like a EAR file.

       

      @Remote

      public interface ITesting {
      ....

      }

       

      @Stateless(mappedName="TestingService")    // try aslo with    @RemoteBinding (jndiBinding ="TestingService")

      public class Testing implements ITesting {
      ...
      }

       

      MyClass:

      ...

      InitialContext icntx=new InitialContext();

      (ITesting) icntx.lookup("TestingService");     // Here i got Exception.

      ....

       

      ERROR:

       

      18:17:18,062 ERROR [STDERR] javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@1ce70c5]

       

      18:17:18,062 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508)

       

      18:17:18,062 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824)

       

      18:17:18,062 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

       

      18:17:18,062 ERROR [STDERR]     at javax.naming.InitialContext.lookup(Unknown Source)

       

      18:17:18,062 ERROR [STDERR]     at StartServlet.getTestingService(StartServlet.java:111)

       

      18:17:18,062 ERROR [STDERR]     at StartServlet$1.run(StartServlet.java:52)

       

      18:17:18,062 ERROR [STDERR] Caused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@1ce70c5

       

      18:17:18,062 ERROR [STDERR]     at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:410)

       

      18:17:18,062 ERROR [STDERR]     at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134)

       

      18:17:18,062 ERROR [STDERR]     at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)

       

      18:17:18,062 ERROR [STDERR]     at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)

       

      18:17:18,062 ERROR [STDERR]     at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)

       

      18:17:18,062 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)

       

      18:17:18,062 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)

       

      18:17:18,078 ERROR [STDERR]     ... 5 more

       

      18:17:18,078 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: Testing.Service.ITesting

       

      18:17:18,078 ERROR [STDERR]     at java.net.URLClassLoader$1.run(Unknown Source)

       

      18:17:18,078 ERROR [STDERR]     at java.security.AccessController.doPrivileged(Native Method)

       

      18:17:18,078 ERROR [STDERR]     at java.net.URLClassLoader.findClass(Unknown Source)

       

      18:17:18,078 ERROR [STDERR]     at java.lang.ClassLoader.loadClass(Unknown Source)

       

      18:17:18,078 ERROR [STDERR]     at java.lang.ClassLoader.loadClass(Unknown Source)

       

      18:17:18,078 ERROR [STDERR]     at java.lang.Class.forName0(Native Method)

       

      18:17:18,078 ERROR [STDERR]     at java.lang.Class.forName(Unknown Source)

       

      18:17:18,078 ERROR [STDERR]     at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:406)

       

      18:17:18,078 ERROR [STDERR]     ... 11 more

        • 1. ERROR:Could not dereference object
          Benjamin Seyinbour Expert

          18:17:18,078 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: Testing.Service.ITesting

           

          Check that you have the correct package 'Testing.Service.ITesting'

           

          If you like, you may want to try the following -- albeit, your problem is ClassNotFoundException as above:

           

          @Remote

          public interface ITesting {

          ....

          }

           

          @Stateless

          public class Testing implements ITesting {

          ...

          }

           

          MyClass:

           

          @javax.ejb.EJB

          private ITesting testingManager;

           

           

          Alternatives:

           

          ITesting testingManager = (ITesting)InitialContext.doLookup("java:global/yourEARName/yourEJBName/Testing!Testing.Service.ITesting");

          ITesting testingManager = (ITesting)InitialContext.doLookup("java:app/yourEJBName/Testing!Testing.Service.ITesting");

          ITesting testingManager = (ITesting)InitialContext.doLookup("java:module/Testing!Testing.Service.ITesting");

          • 2. Re: ERROR:Could not dereference object
            Mitja Skuhala Newbie

            It doesn't work.

             

            I thing the problem is in EAR project, because you can not acces to eny interface in it.

             

            For exampe:

            I made some EJB Core project wiht all classes and Interfaces. Deployed like Core.EAR. And other projects could not find the interface.
            So...I deployed like Core.jar and woks.

             

            The only soluting i got:

            To have some EJB Project with all interfaces and clasees in deployed like EJB project ( Core.jar)
            Other EJB Project can be in EAR project. (TestingService.ear)

             

            -Core.jar
            -TestingSerivce.ear (includes TestingService.jar)
            -TestingWeb.war ( Where i'm testing my bean)