I am doing first ejb program on jboss 4.0.2. i deployed ejb module
successfully. but client program (web application ) giving error. i am trying
to call local ejb.
Error
javax.naming.NamingException: ejb-local-ref: 'ejb/ejb2', with web.xml ejb-link:
'HelloBean' failed to resolve to an ejb with a LocalHome)
ejb-jar.xml
<enterprise-beans>
| <session>
|
| <ejb-name>alr</ejb-name>
| <home>com.HelloHome</home>
| <remote>com.Hello</remote>
| <local-home>com.HelloLocalHome</local-home>
| <local>com.HelloLocal</local>
| <ejb-class>com.HelloBean</ejb-class>
| <session-type>Stateless</session-type>
| <transaction-type>Container</transaction-type>
| </session>
| </enterprise-beans>
| </ejb-jar>
jboss.xml
<jboss>
| <enterprise-beans>
| <session>
| <ejb-name>alr</ejb-name>
| <jndi-name>jndi</jndi-name>
| <method-attributes></method-attributes>
| </session>
| </enterprise-beans>
| <assembly-descriptor></assembly-descriptor>
| <resource-managers>
|
| </resource-managers>
| </jboss>
web.xml ejb related code
<ejb-local-ref>
| <ejb-ref-name>ejb/alr</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <local-home>com.HelloLocalHome </local-home>
| <local>com.HelloLocal</local>
| <ejb-link>HelloBean</ejb-link>
| </ejb-local-ref>
jboss-web.xml
<ejb-ref>
| <ejb-ref-name>ejb/alr</ejb-ref-name>
| <local-jndi-name>jndi</local-jndi-name>
|
| </ejb-ref>
|
client jsp page
Properties props = new Properties();
| props.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| props.put(Context.URL_PKG_PREFIXES,
| "org.jboss.naming:org.jnp.interfaces");
| props.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
|
|
| Context ctx = new InitialContext(props);
|
| System.out.println("It;s ok");
|
|
| HelloLocalHome home=(HelloLocalHome) ctx.lookup("java/env/ejb/alr");
| HelloLocal bean = home.create();
| String hello= bean.hello();
| bean.remove();
| ctx.close();
What is the wrong in above code. Please tell me. I have been trying for this.
some issues:
1. If i don't write optional jboss.xml what is the optional jndi name for
jboss4.0.2
2. while calling local ejb on same machine, jndi properties are not required.
can you confirm?
Advanced thanks. Please give answer
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4175378#4175378
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4175378
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user