I wrote a CMP Entity Bean in JBuilder5 and test it with the EJB's test client generated by the JBuilder's wizard,everything is ok! And then,I wrote a Stateless Session Bean to call that Entity Bean,at first ,I put the two beans in one project's one JAR file,it also works well.But when i put the two beans in two JAR files,still in one project,throws out the "ClassCastException",I don't know the reason,could you tell me?Thanks.

Throwing java.rmi.RemoteException for the container-started transaction for method: public abstract java.lang.String[] titan.travelagent.TravelAgentRemote.listCabins(int,int) throws java.rmi.RemoteException java.rmi.ServerException: null; nested exception is: java.lang.ClassCastException: com.inprise.vbroker.rmi.CORBA.ObjectImpl java.lang.ClassCastException: com.inprise.vbroker.rmi.CORBA.ObjectImpl at titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:42) at java.lang.reflect.Method.invoke(Native Method) at com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:25) at com.inprise.ejb.EJBContext.invoke(EJBContext.java:129) at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1055) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:572) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:548) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:255) at titan.travelagent.TravelAgentRemotePOAInvokeHandler.listCabins(TravelAgentRemotePOAInvokeHandler.java:37) at titan.travelagent.TravelAgentRemotePOAInvokeHandler.listCabins(TravelAgentRemotePOAInvokeHandler.java:71) at titan.travelagent.TravelAgentRemotePOA._invoke(TravelAgentRemotePOA.java:64) at titan.travelagent.TravelAgentRemotePOA._invoke(TravelAgentRemotePOA.java:43) at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2355) at com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:104) at com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInterceptorManager.java:64) at com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.java:492) at com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapter.java:64)

at com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAdapter.java:653) at com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.java:99) at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)

I've run into it too, and did some research both in my application and on the internet. My situation was that I was calling my EJB in Jboss, from a servlet in Tomcat, and I got a ClassCastException, when doing the PortableRemoteObject cast. The reason is that your container and client CAN use different classloaders when they're not in the same jar/ear/war.
I solved this by using two JDK's, one for jboss, and one for Tomcat. The tomcat one has a lot of extra jars in the jdk/jre/lib/ext folder, amongst others all JBoss jars, and my application jar. This is a very crude solution but it works. Who has a better solution than the one presented??

TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations technology projects - with its network of technology-specific websites, events and online magazines.