geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lasantha Ranaweera <lasan...@opensource.lk>
Subject Re: Eclipse + Geronimo + EJB = NullPointerException?
Date Fri, 27 Oct 2006 10:31:28 GMT
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
> {
>    /**
>     * <!-- begin-xdoclet-definition -->
>     * @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:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <web-app id="WebApp_ID" version="2.4"
>>> 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">
>>> 	<display-name>
>>> 	ZooWeb</display-name>
>>> 	<welcome-file-list>
>>> 		<welcome-file>index.html</welcome-file>
>>> 		<welcome-file>index.htm</welcome-file>
>>> 		<welcome-file>index.jsp</welcome-file>
>>> 		<welcome-file>default.html</welcome-file>
>>> 		<welcome-file>default.htm</welcome-file>
>>> 		<welcome-file>default.jsp</welcome-file>
>>> 	</welcome-file-list>
>>> 	<ejb-local-ref>
>>> 		<ejb-ref-name>ejb/Tiger</ejb-ref-name>
>>> 		<ejb-ref-type>Session</ejb-ref-type>
>>> 		<local-home>com.zoo.TigerLocalHome</local-home>
>>> 		<local>com.zoo.TigerLocal</local>
>>> 		<ejb-link>Tiger</ejb-link>
>>> 	</ejb-local-ref>
>>> </web-app>
>>>
>>> I updated the test.jsp to use the LocalHome:
>>>
>>> <%@ page language="java" contentType="text/html; charset=UTF-8"
>>>     pageEncoding="UTF-8"%>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>> "http://www.w3.org/TR/html4/loose.dtd">
>>> <%@page import="javax.naming.*"%>
>>> <%@page import="com.zoo.*"%>
>>> <html>
>>> <head>
>>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>>> <title>Insert title here</title>
>>> </head>
>>> <body>
>>> <%
>>> Context ctx = new InitialContext();
>>> TigerLocalHome tlh = (TigerLocalHome)
>>> ctx.lookup("java:comp/env/ejb/Tiger");
>>> TigerLocal tl = tlh.create();
>>> tl.foo("Test!");
>>> %>
>>> <b></b>
>>> </body>
>>> </html>
>>>
>>> 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":
>>>
>>> 	/** 
>>> 	 *
>>> 	 * <!-- begin-xdoclet-definition --> 
>>> 	 * @ejb.interface-method view-type="both"
>>> 	 * <!-- end-xdoclet-definition --> 
>>> 	 * @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. 
>>>>
>>>> <!-- To refer local EJB's  -->
>>>> 	<ejb-local-ref>
>>>> 		<ejb-ref-name>ejb/BankManagerFacade</ejb-ref-name>
>>>> 		<ejb-ref-type>Session</ejb-ref-type>
>>>> 		<local-home>org.apache.geronimo.samples.bank.ejb.BankManagerFacadeHomeLocal</local-home>
>>>> 		<local>org.apache.geronimo.samples.bank.ejb.BankManagerFacadeLocal</local>
>>>> 		<ejb-link>BankManagerFacadeBean</ejb-link>
>>>> 	</ejb-local-ref>
>>>> 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:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <web-app id="WebApp_ID" version="2.4"
>>>>> 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">
>>>>> 	<display-name>
>>>>> 	ZooWeb</display-name>
>>>>> 	<welcome-file-list>
>>>>> 		<welcome-file>index.html</welcome-file>
>>>>> 		<welcome-file>index.htm</welcome-file>
>>>>> 		<welcome-file>index.jsp</welcome-file>
>>>>> 		<welcome-file>default.html</welcome-file>
>>>>> 		<welcome-file>default.htm</welcome-file>
>>>>> 		<welcome-file>default.jsp</welcome-file>
>>>>> 	</welcome-file-list>
>>>>> </web-app>
>>>>>
>>>>>
>>>>>
>>>>> This is the content of geronimo-web.xml:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
>>>>> 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">
>>>>>   <sys:environment>
>>>>>     <sys:moduleId>
>>>>>       <sys:groupId>default</sys:groupId>
>>>>>       <sys:artifactId>ZooWeb</sys:artifactId>
>>>>>       <sys:version>1.0</sys:version>
>>>>>       <sys:type>car</sys:type>
>>>>>     </sys:moduleId>
>>>>>   </sys:environment>
>>>>>   <context-root>/ZooWeb</context-root>
>>>>> </web-app>
>>>>>
>>>>> 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/buildingejbs.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"%>
>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>>>>>> "http://www.w3.org/TR/html4/loose.dtd">
>>>>>>> <html>
>>>>>>> <head>
>>>>>>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>>>>>>> <title>Insert title here</title>
>>>>>>> </head>
>>>>>>> <body>
>>>>>>> <%
>>>>>>> com.zoo.Tiger tiger = null;
>>>>>>> try {
>>>>>>> 	com.zoo.TigerHome home = com.zoo.TigerUtil.getHome();
>>>>>>> 	tiger = home.create();  
>>>>>>> } catch(Exception exception) {
>>>>>>> }
>>>>>>> %>
>>>>>>> <b><%= tiger.foo("Test") %></b>
>>>>>>> </body>
>>>>>>> </html>
>>>>>>>
>>>>>>> 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.java: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(ApplicationFilterChain.java:252)
>>>>>>> 	at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>>>>>> 	at
>>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>>>>>> 	at
>>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>>>>>>> 	at
>>>>>>> org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
>>>>>>> 	at org.apache.geronimo.tomcat.GeronimoStandardContext
>>>>>>> $SystemMethodValve.invoke(GeronimoStandardContext.java:342)
>>>>>>> 	at
>>>>>>> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31)
>>>>>>> 	at
>>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>>>>>> 	at
>>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>>>>>> 	at
>>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>>>>>>> 	at
>>>>>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
>>>>>>> 	at
>>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>>>>>>> 	at
>>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>>>>>>> 	at org.apache.coyote.http11.Http11BaseProtocol
>>>>>>> $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>>>>>>> 	at
>>>>>>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>>>>>> 	at
>>>>>>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.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?
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>   
>>>>>       
>>>>>           
>>>   
>>>       
>
>
>   


Mime
View raw message