This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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
 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic