• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting NullPointerException while accessing Local EJB

 
satyajit bhosale
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I am getting following exception while accessing local ejb --

java.lang.NullPointerException
at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
at $Proxy0.create(Unknown Source)
at HelloEJBClient.main(HelloEJBClient.java:36)
-------------------------------------------------------------------------

My client code --
HelloEJBClient.java -
--------------------
public class HelloEJBClient {

public static void main(String[] args) {
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, "java.naming.security.principal");
env.put(Context.SECURITY_CREDENTIALS, "java.naming.security.credentials");
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");

try {
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("HelloLocalEJB");
HelloEJBHome home = (HelloEJBHome) obj;
HelloEJB helloWorld = home.create();
helloWorld.hello();
} catch(Exception e) {
e.printStackTrace();
}
}
}

----------------------------------------------------------------------

jboss.xml --
---------

<jboss>
<enterprise-beans>
<session>
<ejb-name> HelloLocalEJB </ejb-name>
<jndi-name> HelloLocalEJB </jndi-name>
<local-jndi-name> HelloLocalEJB </local-jndi-name>
</session>
</enterprise-beans>

<enforce-ejb-restrictions></enforce-ejb-restrictions>
<container-configurations></container-configurations>
<unauthenticated-principal></unauthenticated-principal>

<resource-managers>
</resource-managers>


</jboss>

----------------------------------------------------------------------

ejb-jar.xml --
-----------

<ejb-jar>

<display-name> HelloLocalEJB</display-name>

<enterprise-beans>
<session>
<ejb-name> HelloLocalEJB </ejb-name>
<local-home> HelloEJBHome </local-home>
<local> HelloEJB </local>

<ejb-class> HelloEJBBean </ejb-class>
<session-type> Stateless </session-type>
<transaction-type> Container </transaction-type>
</session>
</enterprise-beans>

<assembly-descriptor>
<security-role>
<role-name> everyone </role-name>
</security-role>

<method-permission>
<role-name> everyone </role-name>
<method>
<ejb-name> HelloLocalEJB </ejb-name>
<method-intf> Local </method-intf>
<method-name> * </method-name>
</method>
</method-permission>

</assembly-descriptor>

</ejb-jar>

----------------------------------------------------------------------


Thanks,
satyajit
 
Lave Kulshreshtha
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Are your remote EJB's working fine on JBoss? Which version of JBoss are you using?

-Lave
 
satyajit bhosale
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, Remote ejb works fine.
I am using JBoss 3.2.6, jdk 1.4.2

thanks,
satyajit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic