6 Replies Latest reply on Sep 30, 2005 1:42 AM by Martin Ganserer

    Test local interface

    Martin Ganserer Novice

      Hello,

      I created a simple entity bean and a session bean that works as a DAO for this entity bean.
      I made a small test app in eclipse. When I use the remote interface of my DAO everything works fine. But when I switch to the local interface I get an error like this:

      Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference
       at org.jboss.ejb3.LocalProxy.readObject(LocalProxy.java:50)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
       at java.io.ObjectInputStream.readSerialData(Unknown Source)
       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
       at java.io.ObjectInputStream.readObject0(Unknown Source)
       at java.io.ObjectInputStream.readObject(Unknown Source)
       at java.rmi.MarshalledObject.get(Unknown Source)
       at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
       at javax.naming.InitialContext.lookup(Unknown Source)
       at com.kontron.fc.test.Client.main(Client.java:56)
      


      My test app looks like this:

      // Get data access object!
      CustomerDAO customerDAO = (CustomerDAO) ctx.lookup(CustomerDAO.class.getName());


      Can I use the remote interface only when I test my app by this approach?
      I don't have to mention that client test app and JBOSS are running on the same machine!