Excellent!

-David

On Nov 18, 2006, at 6:25 PM, Francesco Sessa wrote:

Hi,
thanks for helps. The zip file that you link me, work correctly.
Tomorrow i study the code and the configuration files, because now it's 3:23 AM in Italy.
Thanks very much.


David Blevins ha scritto:
On Nov 18, 2006, at 2:05 AM, Francesco Sessa wrote:

Hi,
i don't be able to download the moviefun.zip. If i insert the link below in my browser, i download a damaged zip file.
Can you help me?
I tryed with the moviefun.war contained in my openejb-1.0 directory, but i deploy it in the webapps directory, and the _requested resource (/moviefun/setup.jsp) is not available.

I wonder if you don't have another Tomcat process running. Definitely check that this is not the case. If you're on windows check your running services and make sure you don't have a previous install of Tomcat running as a service in the background.

It helps me sometimes when people are able to show the exact commands to get something running, so I ran through a quick setup for you on my machine and here are the exact commands I ran straight from my history file.

  499  cd /tmp/
500 wget http://apache.cs.utah.edu/tomcat/tomcat-5/v5.5.20/bin/ apache-tomcat-5.5.20.tar.gz 501 wget http://dist.codehaus.org/openejb/distributions/ openejb-1.0.tar.gz
  502  tar xzvf openejb-1.0.tar.gz
  503  tar xzvf apache-tomcat-5.5.20.tar.gz
  504  mkdir apache-tomcat-5.5.20/webapps/moviefun
  505  cd apache-tomcat-5.5.20/webapps/moviefun/
  506  jar xvf /tmp/openejb-1.0/war/moviefun.war
  507  ls
  508  emacs WEB-INF/web.xml
  509  cd ..
  510  cd ..
  511  ./bin/startup.sh

When tomcat starts, the moviefun app is up and running with no issues. Here's my java version too for good measure:

  $ java -version
  java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
  Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

I've also zipped up both Tomcat and OpenEJB with the Moviefun app installed and put it up for you to download:

  http://people.apache.org/~dblevins/tmp/openejb-tomcat-moviefun.zip

When you unzip that file you will only have to edit the moviefun/ WEB-INF/web.xml file and correct the path to OpenEJB to reflect where you unpacked the zip. It is guaranteed not to work if that step is not done correctly.

Hope this does the trick!  Let us know either way.

Thanks,
David

_

*type* Status report

*message* _/moviefun/setup.jsp_

*description* _The requested resource (/moviefun/setup.jsp) is not available._


Francesco Sessa ha scritto:
Hi,
thanks for the reply,
i try the moviefun...
hopefully

bye


David Blevins ha scritto:
I'm not sure what could be going on as your bean appears to be loaded and should be available to you via initialContext.lookup ("Hello");

There is an alternative to the way you're integrating OpenEJB and Tomcat and one which is in my opinion way simpler in terms of the app development and integration. We even have a small sample application which you could use as a "starter" app slowly modify it into what you'd like for your studies.

The app is here:

http://fisheye.codehaus.org/browse/~tarball=zip/openejb/tags/ v1_0/examples/moviefun/moviefun.zip

Start with a completely fresh Tomcat install and a completely fresh OpenEJB install next to it. Then just compile that app, copy the war file into Tomcat, add the init-param as described in the README.txt and you be off and running.

The app is a little movie database program that has 2 JSPs, 1 Stateless SessionBean, and 1 CMP EntityBean.

-David

On Nov 17, 2006, at 2:01 PM, Francesco Sessa wrote:

Hi David, and hi all,
this is the openejb.log, start tomcat:

INFO : ***************************************************************** ***************
OpenEJB http://www.openejb.org
Startup: 17/11/06 22.57
Copyright 1999-2004 (C) OpenEJB Project, All Rights Reserved.
Version: 1.0
Build date: 20060226
Build time: 1701
***************************************************************** ***************


INFO :  openejb.home = C:\Programmi\openejb-1.0
INFO :  openejb.base = C:\Programmi\openejb-1.0
DEBUG: Instantiating assembler class org.openejb.alt.assembler.classic.Assembler WARN : Cannot find the configuration file [null], Trying conf/ openejb.conf instead. INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \openejb-itests-beans.jar INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \openejb-webadmin-clienttools.jar INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \openejb-webadmin-ejbgen.jar INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \openejb-webadmin-main.jar
WARN :  Reading openejb-jar.xml.
org.openejb.OpenEJBException: Cannot find the openejb-jar.xml in C:\Programmi\openejb-1.0\beans\myHelloEjb.jar. at org.openejb.alt.config.Unmarshaller.unmarshalFromJar (Unmarshaller.java:101) at org.openejb.alt.config.Unmarshaller.unmarshal (Unmarshaller.java:90) at org.openejb.alt.config.Unmarshaller.unmarshal (Unmarshaller.java:82) at org.openejb.alt.config.EjbJarUtils.readOpenEjbJar (EjbJarUtils.java:112) at org.openejb.alt.config.EjbJarUtils.<init> (EjbJarUtils.java:97) at org.openejb.alt.config.ConfigurationFactory.loadDeployments (ConfigurationFactory.java:1210) at org.openejb.alt.config.ConfigurationFactory.getOpenEjbConfigurati on(ConfigurationFactory.java:201) at org.openejb.alt.assembler.classic.Assembler.init (Assembler.java:132)
   at org.openejb.OpenEJB.init(OpenEJB.java:236)
   at org.openejb.tomcat.TomcatLoader.init(TomcatLoader.java:88)
   at org.openejb.tomcat.TomcatLoader.init(TomcatLoader.java:78)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
at org.openejb.loader.LoaderServlet$LoaderWrapper.init (LoaderServlet.java:171) at org.openejb.loader.LoaderServlet.init(LoaderServlet.java: 98) at org.apache.catalina.core.StandardWrapper.loadServlet (StandardWrapper.java:1105) at org.apache.catalina.core.StandardWrapper.load (StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup (StandardContext.java:3951) at org.apache.catalina.core.StandardContext.start (StandardContext.java:4225) at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployWAR (HostConfig.java:809) at org.apache.catalina.startup.HostConfig.deployWARs (HostConfig.java:698) at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:472) at org.apache.catalina.startup.HostConfig.start (HostConfig.java:1122) at org.apache.catalina.startup.HostConfig.lifecycleEvent (HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java:442) at org.apache.catalina.core.StandardService.start (StandardService.java:450) at org.apache.catalina.core.StandardServer.start (StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java: 551)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:294) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:432) INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \myHelloEjb.jar INFO : Loaded EJBs from C:\Programmi\openejb-1.0\beans \CiaoWS.jar
DEBUG:  Containers        : 4
DEBUG:  Type        Container ID
DEBUG:     ENTITY      Default BMP Container
DEBUG:     ENTITY      Default CMP Container
DEBUG:     STATEFUL    Default Stateful Container
DEBUG:     STATELESS   Default Stateless Container
DEBUG:  Deployments       : 38
DEBUG:  Type        Deployment ID
DEBUG:     STATEFUL    client/tests/stateful/EncBean
DEBUG: CMP_ENTITY client/tests/entity/cmp/RMI-over-IIOP/ EJBHome
DEBUG:     STATEFUL    client/tests/stateful/BasicStatefulHome
DEBUG:     STATELESS   ClientTools/ViewClass
DEBUG:     STATELESS   Webadmin/Configuration
DEBUG:     STATELESS   EJBGenerator/CreateEJB
DEBUG:     STATELESS   Hello
DEBUG:     STATELESS   ClientTools/InvokeObject
DEBUG:     STATELESS   Webadmin/Properties
DEBUG:     STATELESS   CiaoWS
DEBUG: STATEFUL client/tests/stateful/RMI-over-IIOP/ EJBHome
DEBUG:     STATELESS   Webadmin/Home
DEBUG: BMP_ENTITY client/tests/entity/bmp/ allowed_operations/EntityHome
DEBUG:     CMP_ENTITY  client/tests/entity/cmp/EncBean
DEBUG:     STATELESS   httpd/DefaultBean
DEBUG: STATEFUL client/tests/stateful/ BeanManagedBasicStatefulHome
DEBUG:     STATELESS   client/tools/DatabaseHome
DEBUG:     BMP_ENTITY  client/tests/entity/bmp/EncBean
DEBUG:     STATEFUL    config/webadmin/ConfigurationData
DEBUG:     STATEFUL    deploy/webadmin/Deployer
DEBUG:     STATELESS   ClientTools/ViewJndi
DEBUG:     STATELESS   Webadmin/DeploymentList
DEBUG: STATELESS client/tests/stateless/ BeanManagedBasicStatelessHome
DEBUG:     STATELESS   Webadmin/CMPMapping
DEBUG:     STATELESS   client/tests/stateless/EncBean
DEBUG: STATEFUL client/tests/stateful/ BeanManagedTransactionTests/EJBHome DEBUG: BMP_ENTITY client/tests/entity/bmp/RMI-over-IIOP/ EJBHome
DEBUG:     STATELESS   Webadmin/ListLogs
DEBUG: STATELESS client/tests/stateless/ BeanManagedTransactionTests/EJBHome
DEBUG:     STATELESS   ClientTools/ViewEjb
DEBUG:     BMP_ENTITY  client/tests/entity/bmp/BasicBmpHome
DEBUG:     STATEFUL    mapping/webadmin/CMPMappingData
DEBUG:     STATELESS   client/tests/stateless/BasicStatelessHome
DEBUG:     CMP_ENTITY  client/tests/entity/cmp/BasicCmpHome
DEBUG:     STATELESS   Webadmin/Deployment
DEBUG:     STATEFUL    httpd/session
DEBUG: CMP_ENTITY client/tests/entity/cmp/ allowed_operations/EntityHome DEBUG: STATELESS client/tests/stateless/RMI-over-IIOP/ EJBHome DEBUG: SecurityService : org.openejb.ri.sp.PseudoSecurityService DEBUG: TransactionManager: org.openejb.core.TransactionManagerWrapper
INFO :  OpenEJB ready.

Thanks,
Francesco

David Blevins ha scritto:
Hi Francesco,

Couple quick things, could you post your openejb.log file? That'd help us figure out what might have happened to your bean, etc. Or what name should be used to look it up.

Thanks,
David

On Nov 17, 2006, at 1:12 PM, Francesco Sessa wrote:

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





















Reply via email to