• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Getting NullPointerException while accessing Local EJB

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, Remote ejb works fine.
I am using JBoss 3.2.6, jdk 1.4.2

thanks,
satyajit
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic