-----Original Message----- From: Lasantha Ranaweera To: user@geronimo.apache.org Date: Fri, 27 Oct 2006 16:01:28 +0530 Subject: Re: Eclipse + Geronimo + EJB = NullPointerException? > Again things looks ok for me :-) . > > Not sure whether you are deploying correct version or not . > > Also do a small change in you JSP file give a try too. > > tl.foo("Test!"); => String s = tl.foo("Test!"); > > Otherwise I am running out of ideas. :-\ > > Thanks, > Lasantha Ranaweera > > HubertB wrote: > > This is the content of TigerLocal.java: > > > > /* > > * Generated by XDoclet - Do not edit! > > */ > > package com.zoo; > > > > /** > > * Local interface for Tiger. > > * @generated > > * @wtp generated > > */ > > public interface TigerLocal > > extends javax.ejb.EJBLocalObject > > { > > /** > > * > > * @generated //TODO: Must provide implementation for bean method > > stub */ > > public java.lang.String foo( java.lang.String param ) ; > > > > } > > > > > > Am Freitag, den 27.10.2006, 15:20 +0530 schrieb Lasantha Ranaweera: > > > >> Everything looks correct to me here. Can you share xdoclet generated > >> TigerLocal.java files with us? > >> > >> Thanks, > >> Lasantha Ranaweera > >> HubertB wrote: > >> > >>> OK, now my web.xml looks like this: > >>> > >>> > >>> >>> xmlns="http://java.sun.com/xml/ns/j2ee" > >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > >>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > >>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> > >>> > >>> ZooWeb > >>> > >>> index.html > >>> index.htm > >>> index.jsp > >>> default.html > >>> default.htm > >>> default.jsp > >>> > >>> > >>> ejb/Tiger > >>> Session > >>> com.zoo.TigerLocalHome > >>> com.zoo.TigerLocal > >>> Tiger > >>> > >>> > >>> > >>> I updated the test.jsp to use the LocalHome: > >>> > >>> <%@ page language="java" contentType="text/html; charset=UTF-8" > >>> pageEncoding="UTF-8"%> > >>> >>> "http://www.w3.org/TR/html4/loose.dtd"> > >>> <%@page import="javax.naming.*"%> > >>> <%@page import="com.zoo.*"%> > >>> > >>> > >>> > >>> Insert title here > >>> > >>> > >>> <% > >>> Context ctx = new InitialContext(); > >>> TigerLocalHome tlh = (TigerLocalHome) > >>> ctx.lookup("java:comp/env/ejb/Tiger"); > >>> TigerLocal tl = tlh.create(); > >>> tl.foo("Test!"); > >>> %> > >>> > >>> > >>> > >>> > >>> Now I am getting this error: > >>> > >>> Unable to compile class for JSP > >>> An error occurred at line: 12 in the jsp file: /test.jsp > >>> Generated servlet error: > >>> The method foo(String) is undefined for the type TigerLocal > >>> > >>> So I chanced the XDoclet-Tag in TigerBean.java from "remote" to > "both": > >>> > >>> /** > >>> * > >>> * > >>> * @ejb.interface-method view-type="both" > >>> * > >>> * @generated > >>> * > >>> * //TODO: Must provide implementation for bean method stub > >>> */ > >>> public String foo(String param) { > >>> return null; > >>> } > >>> > >>> But I am still getting the "method is undefinded" error. Whats > wrong > >>> now? > >>> > >>> Am Donnerstag, den 26.10.2006, 17:45 +0530 schrieb Lasantha > Ranaweera: > >>> > >>> > >>>> There must be a tag like given in the web.xml if your EJB is > locally > >>>> referred one. > >>>> > >>>> > >>>> > >>>> ejb/BankManagerFacade > >>>> Session > >>>> > org.apache.geronimo.samples.bank.ejb.BankManagerFacadeHom > eLocal > >>>> > org.apache.geronimo.samples.bank.ejb.BankManagerFacadeLocal ocal> > >>>> BankManagerFacadeBean > >>>> > >>>> If still have problem please post your TigerUtil.java, ejb-jar.xml > and > >>>> openejb-jar.xml files. > >>>> > >>>> Have a look at : > >>>> http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html > >>>> > >>>> Thanks, > >>>> Lasantha Ranaweera > >>>> HubertB wrote: > >>>> > >>>> > >>>>> Hi! > >>>>> > >>>>> > >>>>> > >>>>> The web.xml looks like this: > >>>>> > >>>>> > >>>>> >>>>> xmlns="http://java.sun.com/xml/ns/j2ee" > >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > >>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > >>>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> > >>>>> > >>>>> ZooWeb > >>>>> > >>>>> index.html > >>>>> index.htm > >>>>> index.jsp > >>>>> default.html > >>>>> default.htm > >>>>> default.jsp > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> This is the content of geronimo-web.xml: > >>>>> > >>>>> > >>>>> >>>>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" > >>>>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" > >>>>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"> > >>>>> > >>>>> > >>>>> default > >>>>> ZooWeb > >>>>> 1.0 > >>>>> car > >>>>> > >>>>> > >>>>> /ZooWeb > >>>>> > >>>>> > >>>>> Am Donnerstag, den 26.10.2006, 16:46 +0530 schrieb Lasantha > Ranaweera: > >>>>> > >>>>> > >>>>> > >>>>>> Hi Hurbert, > >>>>>> > >>>>>> Can you post geronimo-web.xml file and web.xml files? I think > you can > >>>>>> find those files from your project. > >>>>>> > >>>>>> Thanks, > >>>>>> Lasantha Ranaweera > >>>>>> HubertB wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>>> Hi! > >>>>>>> > >>>>>>> I need a bit help getting this EJB-Tutorial to run on Geronimo > 1.1: > >>>>>>> > http://www.eclipse.org/webtools/community/tutorials/ejbtutorial/buildin > gejbs.html > >>>>>>> > >>>>>>> I am using Eclipse 3.2.1 with WTP 1.5.1, JEM 1.2.1, EMF 2.1, > GEF 3.2.1, > >>>>>>> Geronimo-Plugin 1.1 (from this file: > >>>>>>> g-eclipse-plugin-1.1-v200610161117-deployable) and XDoclet > 1.2.3. > >>>>>>> > >>>>>>> > >>>>>>> This is what I have done: > >>>>>>> > >>>>>>> 1. Create a J2EE => Enterprise Application Project and name it > >>>>>>> "ZooBeansProject" > >>>>>>> 2. Create a EJB => EJB Project, name it "ZooBeans", check "Add > project > >>>>>>> to an EAR" and choose "ZooBeansProject" > >>>>>>> 3. In "ZooBeans" I created a new EJB => XDoclet Enterprise > JavaBean, > >>>>>>> Type = Session Bean, Package = com.zoo, name = "TigerBean" > >>>>>>> 4. Rightclick on "Apache Geronimo v1.1 Server @ localhost", > choose "Add > >>>>>>> and Remove Projects..." and add "ZooBeansProject" > >>>>>>> 5. Started Geronimo and noticed that ZooBeansProject has been > deployed > >>>>>>> to the server > >>>>>>> 6. Created a Web => Dynamic Web Project named "ZooWeb", also > checked > >>>>>>> "Add project to an EAR" and chose "ZooBeansProject" > >>>>>>> 7. In "ZooWeb", I created "test.jsp" containing the following > code: > >>>>>>> > >>>>>>> <%@ page language="java" contentType="text/html; charset=UTF-8" > >>>>>>> pageEncoding="UTF-8"%> > >>>>>>> >>>>>>> "http://www.w3.org/TR/html4/loose.dtd"> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Insert title here > >>>>>>> > >>>>>>> > >>>>>>> <% > >>>>>>> com.zoo.Tiger tiger = null; > >>>>>>> try { > >>>>>>> com.zoo.TigerHome home = com.zoo.TigerUtil.getHome(); > >>>>>>> tiger = home.create(); > >>>>>>> } catch(Exception exception) { > >>>>>>> } > >>>>>>> %> > >>>>>>> <%= tiger.foo("Test") %> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> 8. Rightclick on "test.jsp", select "Run As" => "Run on Server" > then I > >>>>>>> get this error: > >>>>>>> > >>>>>>> 12:13:56,670 ERROR [[jsp]] Servlet.service() for servlet jsp > threw > >>>>>>> exception > >>>>>>> java.lang.NullPointerException > >>>>>>> at > org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:60) > >>>>>>> at > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > >>>>>>> at > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > >>>>>>> at > >>>>>>> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j > ava:332) > >>>>>>> at > >>>>>>> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314 > ) > >>>>>>> at > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) > >>>>>>> at > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic > ationFilterChain.java:252) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil > terChain.java:173) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal > ve.java:213) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal > ve.java:178) > >>>>>>> at > >>>>>>> > org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubj > ectValve.java:56) > >>>>>>> at org.apache.geronimo.tomcat.GeronimoStandardContext > >>>>>>> $SystemMethodValve.invoke(GeronimoStandardContext.java:342) > >>>>>>> at > >>>>>>> > org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(Geroni > moBeforeAfterValve.java:31) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav > a:126) > >>>>>>> at > >>>>>>> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav > a:105) > >>>>>>> at > >>>>>>> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve > .java:107) > >>>>>>> at > >>>>>>> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:54 > 1) > >>>>>>> at > >>>>>>> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: > 148) > >>>>>>> at > >>>>>>> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:8 > 69) > >>>>>>> at org.apache.coyote.http11.Http11BaseProtocol > >>>>>>> > $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667) > >>>>>>> at > >>>>>>> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoin > t.java:527) > >>>>>>> at > >>>>>>> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollo > werWorkerThread.java:80) > >>>>>>> at org.apache.tomcat.util.threads.ThreadPool > >>>>>>> $ControlRunnable.run(ThreadPool.java:684) > >>>>>>> at java.lang.Thread.run(Thread.java:595) > >>>>>>> > >>>>>>> Whats wrong here? > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>> > >>>>> > >>>>> > >>> > >>> > > > > > > > ----------- Taller Internacional "Por el bienestar del anciano" del 20 al 23 de noviembre Universidad de Granma [ http://www.udg.co.cu ] http://www.udg.co.cu/mrtg/weather/weather.html Imagenes de Cuba desde el satÚlite http://intranet.udg.co.cu/ImagenSatelite/satelite.html http://www.udg.co.cu/mrtg/map/archive/