File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cmp java.rmi.ServerException(need urgent help)

 
S Rubia
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jboss jboss-3.0.6_tomcat-4.1.18 jdk1.3 winxp
following code compile completely fine packed in a jar file with META-INF\ejb-jar.xml,deployed successfully in server\default\deploy
at runtime got error.
public interface HelloEntityObject extends EJBObject
{
public void setName(String name) throws RemoteException;
public String getName() throws RemoteException;
}

public interface HelloEntityHome extends EJBHome
{
public HelloEntityObject create(Integer id)
throws RemoteException,CreateException;
public HelloEntityObject findByPrimaryKey(Integer pk)
throws FinderException,RemoteException;
}

public abstract class HelloEntityBean implements EntityBean
{
public Integer id;
public String name;

public Integer ejbCreate(Integer id) throws CreateException
{ System.out.println("in ejbCreate");
this.setId(id);
return null;
}


public abstract void setId(Integer id);
public abstract Integer getId();
public abstract void setName(String name);
public abstract String getName();

public void setEntityContext(EntityContext ctx){System.out.println("in EntityContext");}
public void unsetEntityContext(){}
public void ejbPostCreate(Integer id){System.out.println("in ejbPostCreate");}
public void ejbPassivate(){}
public void ejbLoad(){}
public void ejbRemove(){}
public void ejbStore(){}
}
public class EntityClient
{
public static void main(String ar[])
{
try{
Context jndictx=new InitialContext();
System.out.println("initialContext Created");
Object ref=jndictx.lookup("HelloEntityObject");
System.out.println("in lookup");
HelloEntityHome home=(HelloEntityHome)PortableRemoteObject.narrow(ref,HelloEntityHome.class);
System.out.println("got object");
HelloEntityObject entity_1=home.create(new Integer(1));
System.out.println("object created");
entity_1.setName("JAVA");
System.out.println("The Name has been set");
Integer pk=new Integer(1);
HelloEntityObject entity_2=home.findByPrimaryKey(pk);
System.out.println("The Name Is:"+entity_2.getName());
}
catch(Exception re){System.out.println(re);re.printStackTrace();}
jndi.properties file text:
==============================
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
java.naming.provider.url=localhost:1099

ejb-jar.xml contents:
===========================
<!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>HelloEntityObject</ejb-name>
<home>HelloEntityHome</home>
<remote>HelloEntityObject</remote>
<ejb-class>HelloEntityBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>HelloEntityObject</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<security-identity><use-caller-identity/></security-identity>
</entity>
</enterprise-beans>
</ejb-jar>

Exception:
================
initialContext created
in lookup
got object
java.rmi.ServerException: RemoteException occured in server thread; nested exception is:
java.rmi.ServerException: EJBException:; nested Exception is:
javax.ejb.EJBException: null; CausedByException is: null
jboss consol exception:
===========================
INFO [STDOUT] in ejbCreate
ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException, causedBy:
java.lang.NullPointerException
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.getEntityState(JDBCEntityBridge.java:598)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.isCreated(JDBCEntityBridge.java:460)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setValue(JDBCAbstractCMPFieldBridge.java:172)
at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:126)
at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
at HelloEntityBean$Proxy.setId(<generated>
at HelloEntityBean.ejbCreate(HelloEntityBean.java:14)
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:221)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:731)
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1119)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:207)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
 
Cory Wilkerson
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might look into jbosscmp-jdbc.xml -- to be packaged under META-INF in your ejb jar. The file describes some more CMP information that JBOSS requires, ie, what database to connect to, whether or not to automatically create the table structure, etc.
The entries in jbosscmp-jdbc.xml largely mirror the cmp entries in ejb-jar.xml.
Good luck,
Cory
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"zoobi",
Thanks for joining JavaRanch, but could you just take a quick look at the naming policy and edit your profile.
Also, only members with valid names will be eligible for the book giveaways.
Thanks
Simon
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic