0 Replies Latest reply on Apr 4, 2003 2:56 PM by rubia

    java.rmi.serverException+null pointer exception

    rubia

      Using jboss jboss-3.0.6_tomcat-4.1.18 jdk1.3

      following code compile completely fine packed in a jar file with META-INF\ejb-jar.xml,deployed successfully in server\default\deploy
      At runtime i 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(3));
      System.out.println("object created");
      entity_1.setName("EJB");
      System.out.println("The Name has been set");

      Integer pk=new Integer(3);
      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:org.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>

      <ejb-name>HelloEntityObject</ejb-name>
      HelloEntityHome
      HelloEntityObject
      <ejb-class>HelloEntityBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <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>

      </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 cosol 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()
      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)


      Command Prompt commandline access,no browser is using,
      So Whats the problem,can anyone tell me........
      if need any other file whats the contents will be and at which folde it will be placed