Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception upon Lookup for

 
Asman More
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I need some help resolving this problem. Would appreciate your suggestions.

I am using EJB 2.0, weblogic 6.1 SP4. I am trying to use local entity bean (CMP). Upon lookup I get following exceptions. I believe what it says is there is something that is not serilizable in the Bean class; but i think everything is fine here. Can you please help me locating the error?

My client code doesn't even have enough lines to add to confusion -

// part of client
InitialContext ctx = getInitialContext("t3://myhost:7001");
// my getInitialContext method returns the context properly
// No exceptions yet
Object obj = ctx.lookup("fxcode"); // This is the last line of my client

The last line throws the exception below. Why???


---------------- Exception ------------------------------
Exception in thread "main" javax.naming.ConfigurationException. Root exception is java.rmi.MarshalException: error marshalling return; nested exception is:

java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl

Start server side stack trace:

java.rmi.MarshalException: error marshalling return; nested exception is:
java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl

java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:115)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:121)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

End server side stack trace

; nested exception is:

java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl


Start server side stack trace:

java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:115)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:121)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

End server side stack trace

java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl


Start server side stack trace:
java.io.NotSerializableException: com.forex.FxCodeBean_kupq2p_LocalHomeImpl
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:115)
at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:121)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

End server side stack trace

<<no stack trace available>>

-------------------- Local Home Interface as below ------------------
package com.forex.fate;

import javax.ejb.*;
import java.rmi.*;

public interface FxCodeLocalHome extends EJBLocalHome {
FxCodeLocal create(Integer tkey) throws CreateException;
public FxCodeLocal findByPrimaryKey(Integer key) throws FinderException;
}
----------- Local Component interface as below -------------

package com.forex.fate;

import javax.ejb.*;

public interface FxCodeLocal extends EJBLocalObject {
public Integer getFxKey();
public void setFxKey(Integer key);
}

------------- Bean Class as below ----------

package com.forex.fate;

import javax.ejb.*;

public abstract class FxCodeBean implements EntityBean {
protected EntityContext context;

public void ejbRemove(){}
public void ejbLoad(){}
public void ejbStore(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void unsetEntityContext(){}
public void setEntityContext(EntityContext ctx){
context = ctx;
}

public Integer ejbCreate(Integer tkey) throws CreateException {
return null;
}
public void ejbPostCreate(Integer tkey) throws CreateException {
}
abstract public Integer getFxKey();
abstract public void setFxKey(Integer key);
}

------------------ ejb-jar.xml as below ----------

<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>fxcode</ejb-name>
<local-home>com.forex.fate.FxCodeLocalHome</local-home>
<local>com.forex.fate.FxCodeLocal</local>
<ejb-class>com.forex.fate.FxCodeBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<cmp-field><field-name>fxKey</field-name></cmp-field>
<primkey-field>fxKey</primkey-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>fxcode</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

------------- weblogic-ejb-jar.xml as below -------------

<?xml version="1.0"?>

<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>

<weblogic-ejb-jar>

<weblogic-enterprise-bean>
<ejb-name>fxcode</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<local-jndi-name>fxcode</local-jndi-name>
</weblogic-enterprise-bean>

</weblogic-ejb-jar>

--------- weblogic rdbms jar xml as below --------

<!DOCTYPE weblogic-rdbms-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls600/dtd/weblogic-rdbms20-persistence-600.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>fxcode</ejb-name>
<data-source-name>FXDEV</data-source-name>
<table-name>fx_code</table-name>
<field-map>
<cmp-field>fxKey</cmp-field>
<dbms-column>fx_key</dbms-column>
</field-map>
</weblogic-rdbms-bean>
</weblogic-rdbms-jar>
 
Asman More
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,
Read all forex.fate package declaration as forex.

Thanks!
 
Ramesh Aiyappan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Asman,

I assume that you are trying to look up a bean that is local to a container, from a client outside the container. Local Beans are meant to be accessed locally within the container and you cannot access these Beans from remote clients.

Try accessing the Bean from another entity bean or a session bean that is not local.

Njoy.
[ May 28, 2004: Message edited by: Ramesh Aiyappan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic