tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francesco Sessa <francesco.se...@email.it>
Subject Problem with "Hi"
Date Fri, 17 Nov 2006 21:12:12 GMT
Hi all,
I'm an italian university student.
Sorry for my english.
I have installed openejb 1.0 on my pc, and i copy the war loader in the 
webapps directory of my tomcat 5.5 server.
I have modified the xml file in the war (openejb.home).
I have deployed myHelloEjb.jar (openejb deploy -c -f -a 
C:/myHelloEjb.jar) (ID= Hello Container=1 (the only one).
I create a jsp, openejb.jsp, in webapps/examples, and i create the 
WEB-INF/web.xml. I post the code of the openejb.jsp, and
the code of web.xml:

openejb.jsp:
<%@ page import="org.acme.HelloObject,
    org.acme.HelloHome,
    javax.naming.InitialContext,
    javax.naming.Context,
    java.util.*"%>

<html>
<head>
    <title>OpenEJB -- EJB for Tomcat</title>
</head>

<body>
Stateless Session bean - HelloBean - says:
<%
    Properties p = new Properties();
    p.put("java.naming.factory.initial", 
"org.openejb.client.LocalInitialContextFactory");

    Context initCtx = new InitialContext();

    Object object = initCtx.lookup("java:comp/env/ejb/hello");
    //Object object = initCtx.lookup("Hello");

    HelloHome helloHome = (HelloHome)
        javax.rmi.PortableRemoteObject.narrow(object, HelloHome.class);
    HelloObject bean = helloHome.create();
%>
<%= bean.sayHello() %>
</body>
</html>

web.xml:
    <ejb-ref>
     <description> EJB Reference to the bean deployed to OpenEJB 
</description>
     <ejb-ref-name>ejb/hello</ejb-ref-name>
     <ejb-ref-type>Session</ejb-ref-type>
     <home>org.acme.HelloHome</home>
     <remote>org.acme.Hello</remote>
    </ejb-ref>

I insert in %CATALINA_HOME%/conf/server.xml the code:
<Context path="/examples">
  <Ejb name="ejb/hello" type="Session" home="org.acme.HelloHome" 
remote="org.acme.Hello"/>
  <ResourceParams name="ejb/hello">
    <parameter>
      <name>factory</name>
      <value>org.openejb.client.TomcatEjbFactory</value>
    </parameter>
    <parameter>
      <name>openejb.naming.factory.initial</name>
      <value>org.openejb.client.LocalInitialContextFactory</value>
    </parameter>
    <parameter>
      <name>openejb.ejb-link</name>
      <value>Hello</value>
    </parameter>
  </ResourceParams>
 </Context>

in the "Host" xml-node.
When i launch tomcat, and i go at 
http://localhost:8080/examples/openejb.jsp i read the error report:


  HTTP Status 500 -

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

*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._

*exception*

org.apache.jasper.JasperException
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

java.lang.NullPointerException
	org.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:152)
	javax.naming.InitialContext.lookup(InitialContext.java:351)
	org.apache.jsp.openejb_jsp._jspService(openejb_jsp.java:62)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*note* _The full stack trace of the root cause is available in the 
Apache Tomcat/5.5.20 logs._

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


      Apache Tomcat/5.5.20

If i modify openejb.jsp code in:
Properties p = new Properties();
    p.put("java.naming.factory.initial", 
"org.openejb.client.LocalInitialContextFactory");

    Context initCtx = new InitialContext(p);

    //Object object = initCtx.lookup("java:comp/env/ejb/hello");
    Object object = initCtx.lookup("Hello");

    HelloHome helloHome = (HelloHome)
        javax.rmi.PortableRemoteObject.narrow(object, HelloHome.class);
    HelloObject bean = helloHome.create();


I want to hide in the jsp the openejb factory.
Can you help me please?
I'm in a hurry, because this examples it's important for my graduation 
thesis.
Thank you


Mime
View raw message