Hi,

I need to store different contents in the same EJB3 container as shows in the 
following code.


  | @Entity
  | @Table(name = "wk_container")
  | public class Container implements Serializable
  | {
  |     Long    id;
  |     String  containerName;
  |     
  |     Content content;
  |     
  |     @Id
  |     @GeneratedValue(strategy=GenerationType.AUTO)
  |     public Long getId()
  |     {
  |             return id;
  |     }
  |     
  |     public void setId(Long id)
  |     {
  |             this.id = id;
  |     }
  |     
  |     public String getContainerName()
  |     {
  |             return containerName;
  |     }
  |     
  |     public void setContainerName(String containerName)
  |     {
  |             this.containerName = containerName;
  |     }
  | 
  |     public Content getContent()
  |     {
  |             return content;
  |     }
  |     
  |     public void setContent(Content content)
  |     {
  |             this.content = content;
  |     }
  | 
  | }
  | 
  | public class Content implements java.io.Serializable
  | {
  |     String info1;
  |     Long   info2;
  |     
  |     public String getInfo1()
  |     {
  |             return info1;
  |     }
  |     
  |     public void setInfo1(String info1)
  |     {
  |             this.info1 = info1;
  |     }
  |     
  |     public Long getInfo2()
  |     {
  |             return info2;
  |     }
  |     
  |     public void setInfo2(Long info2)
  |     {
  |             this.info2 = info2;
  |     }
  |     
  |     public void function()
  |     {}      
  | }
  | 
  | 

Container and Content are packaged into a single .jar and deployed into jboss.


My client rich client is


  |         ........
  |         ctx = new InitialContext(props);
  |                 
  |         ContainerManager contManager = (ContainerManager) 
ctx.lookup("ContainerBean/remote");
  |         
  |         Container container1 = new Container();
  |         Container container2 = new Container();
  |         
  |         Content content = new Content();
  | 
  |         content.setInfo1("string info");
  |         content.setInfo2(new Long(1));
  |         
  |         container1.setContainerName("container 1");
  |         container1.setContent(content);                
  |         container1 = contManager.merge(container1);
  |       
  |         
  |         DerivedContent derivedContent = new DerivedContent();
  |         
  |         derivedContent.setInfo1("string info");
  |         derivedContent.setInfo2(new Long(2));
  |         
  |         container2.setContainerName("container 2");
  |         container2.setContent(derivedContent);
  |                 
  |         container2 = contManager.merge(container2);
  |         ........
  | 

DerivedContent is:


  | public class DerivedContent extends Content implements Serializable
  | {
  |     public DerivedContent()
  |     {
  |             super();
  |     }
  | 
  |     @Override
  |     public void function()
  |     {
  |             System.out.println("DerivedContent function");
  |     }
  | }
  | 

When I try to merge the container2 that includes the DerivedContent instance I 
get the following error:


  | Exception in thread "main" java.lang.RuntimeException: 
java.lang.ClassNotFoundException: No ClassLoaders found for: 
testworkflowhandlers.client.DerivedContent (no security manager: RMI class 
loader disabled)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:227)
  |     at 
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:216)
  |     at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
  |     at 
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  |     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:580)
  |     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:450)
  |     at 
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
  |     at 
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
  |     at 
org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
  | Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: 
testworkflowhandlers.client.DerivedContent (no security manager: RMI class 
loader disabled)
  |     at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
  |     at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
  |     at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
  |     at 
org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:79)
  |     at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
  |     at 
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
  |     at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
  |     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
  |     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
  |     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.readArray(ObjectInputStream.java:1628)
  |     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
  |     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
  |     at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:219)
  |     ... 8 more
  | 
The ContainerManager is:


  | @Stateless
  | @Remote(ContainerManager.class)
  | public class ContainerBean implements ContainerManager
  | {
  |     @PersistenceContext(unitName="Workflow")
  |     private EntityManager manager;    
  |     
  |     public void persist(Container container)
  |     {                 
  |         manager.persist(container);
  |     }
  |     
  |     public Container merge(Container container)    
  |     {       
  |         return manager.merge(container);                
  |     }   
  | 
  |     public Container find(Long id)
  |     {
  |         return manager.find(Container.class, id);   
  |     }
  |     
  |     public void remove(Container container)
  |     {
  |         manager.remove(container);
  |     }
  |     
  | }
  | 

It seams to me that the ContainerBean is not able to load DerivedContent since 
it is not into the deployed jar.

Shouldn't DerivedContent transferred by the RMI protocol ?

I can't put DerivedContent into the jar file since the Container should be a 
generic manger for different contents and only the client application should 
know about it.

Can anyone give me any suggestion ?

Thanks 

Fabrizio



PS: My environment is

     * jboss-4.0.3SP1
     * jboss-EJB-3.0_RC5-PFD




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923244#3923244

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923244


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to