0 Replies Latest reply on Sep 27, 2005 7:41 AM by martinganserer

    Test local interface

    martinganserer

      Hi,

      I created an entity bean and a stateless session bean that works as DAO.
      I made a small console application in eclipse to test my DAO. Everything works fine when I use the remote interface, but when I switch to the local interface, I get following error:

      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(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
       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(InitialContext.java:351)
       at com.kontron.fc.test.Client.main(Client.java:56)
      
      


      Jboss and the test application are running on the same VM. This is the code where it crashes:

      DAOCountry countryDAO = (DAOCountry) ctx.lookup(DAOCountry.class.getName());


      Has anybody an idea what goes wrong here?