-
1. Re: java.lang.ClassCastException javax.rmi.PortableRemoteObj
coyotelp May 22, 2006 7:54 AM (in response to layveen)Hi,
I've the same problem.
From Junit Classes It's works fine ( remote Ejb only).
From Servlet Classes :
If I Use : new InitialContext().lookup("java:comp/env/ejb/xxx") , i have a ClassCastException.
If I Use :
Hashtable props = new Hashtable();
props.put(
Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(
Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:2099");
Context ctx = new InitialContext(props);
I have a EJBException during the home.create()
13:38:44,712 ERROR [LogInterceptor] EJBException in method: public abstract com.apollo.server.interfaces.Fibo com.apollo.server.interfaces.FiboHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract com.apollo.server.interfaces.Fibo com.apollo.server.interfaces.FiboHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:161)
I dont understant, the same code with Junit works. -
2. Re: java.lang.ClassCastException javax.rmi.PortableRemoteObj
coyotelp May 24, 2006 11:03 AM (in response to layveen)The solution :
First, edit the conf/jboss-service.xml file and set the NamingService CallByValue to true:
<!-- The call by value mode. true if all lookups are unmarshalled using
the caller's TCL, false if in VM lookups return the value by reference.
-->
true
...
Second, edit the deploy/ear-deployer.xml file and set the Isolated and CallByValue attributes to true:
<!-- EAR deployer, remove if you are not using ear deployments -->
<!-- A flag indicating if ear deployments should have their own scoped
class loader to isolate their classes from other deployments.
-->
true
<!-- A flag indicating if the ear components should have in VM call
optimization disabled.
-->
true
Last, edit the deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml file and set the Java2ClassLoadingCompliance and UseJBossWebLoader attributes to false:
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
false
true
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->
false
... -
3. Re: java.lang.ClassCastException javax.rmi.PortableRemoteObj
eielk May 24, 2006 2:30 PM (in response to layveen)this worked like a charm for me...except i'm using 4.0.4.GA and there is no conf/jboss-service.xml file that has a naming section and call by attribute...
so instead find the settings in the $jboss-home/server/default/deploy/naming-service.xml file.
i was able to leave call-by-value=false in both locations (naming-service.xml and ear-deployer.xml) and everything works.