[jboss-user] [EJB/JBoss] - Problem by jndi-lookup from Tomcat to JBoss
thomas2008ch
do-not-reply at jboss.com
Sun May 25 06:47:06 EDT 2008
Hi all,
I use the XDoclet to build EJB2-porject. The EJB2-project is deployed in JBoss 4.2.2. GA.
I can access/connect to the bean from an jsp (index.jsp) in a war:
| ...
| <body>
| <%
| com.zoo.Tiger tiger = null;
| try{
| com.zoo.TigerHome home = com.zoo.TigerUtil.getHome();
| tiger = home.create();
|
| }catch(Exception exception)
| {
|
| }
| %>
| <b><%= tiger.roar() %></b>
| </body>
| ...
|
The war is included within an ear deployed on JBoss.
I can even access/connect the bean on the server with a standalone java:
| public class TestClient {
|
| public static void main(String[] args) {
| Tiger tiger = null;
| try {
| TigerHome home = TigerUtil.getHome();
| tiger = home.create();
| System.out.println(tiger.roar());
|
| } catch (Exception exception) {
| exception.printStackTrace();
| }
| }
| }
|
With a jndi.properties:
| 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
|
Now I deploy the web/war on Tomcat 6 and try to access/connect to the bean on JBoss. But it failed. My "index.jsp" looks as follow:
| <body>
| <%
| Properties props = new Properties();
| props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| com.zoo.Tiger tiger = null;
| try{
| com.zoo.TigerHome home = com.zoo.TigerUtil.getHome();
| tiger = home.create();
|
| }catch(Exception exception)
| {
|
| }
| %>
| <b><%= tiger.roar() %></b>
| </body>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153212#4153212
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153212
More information about the jboss-user
mailing list