on 02-24-2004 2:35 PM
Hello Web AS developers,
I'm a J2EE newbie just trying to get the Calculator example working.
I've been through the tutorial sequence twice now (very carefully the 2nd time). Everything seems to work and I eventually create my EAR file and deploy it successfully.
However when I try to access the Calculator from my browser I get the following error :
Application error occurs during processing the request.
Details: java.lang.InstantiationException: ID018236: Cannot instantiate bean. java.lang.ClassNotFoundException: class com.sap.engine.examples.beans.calculator.CalcProxy : java.lang.Exception: Error instantiating Calculator EJBcom.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of : CalculatorBean
at jsp_Calculator1077593450504._jspService(jsp_Calculator1077593450504.java:2)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:466)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853).....
The CalcProxy class seems to be in the WAR file OK, with the correct package structure, and the WAR file is in the EAR file OK.
Anybody have any clue what the problem might be?
cheers
Neil
Hi, I also had some problems with the lookup of
calculatorbean in calcproxy. In my tutorial the
lookupstring in the init() of Calcproxy is : "java:comp/env/CalculatorBean.
I had to change it to "java:comp/env/ejb/CalculatorBean"
to fix the problem.
Kind Regards,
Hans
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niel and Others
Generally if you follow the instructions given in the tutorial example will work ( Basically its a combination of web project,ejb project) one of the best example for J2EE Session beans,
MeanWhile do you have proper J2EE enginee running,with Host and port numbers specified in NWDS.have you deployed your peoject ( have buid web , ejb, eas projects properly) have you given the methods add,subtract,multiplication with proper paramaters and its type, have you coded jsp to display the method result(View).
check your project is properly deployed or not in the following link
http://<servername>:<port>/j2EE examples..
i hope if everthing seems ok you can see the output in the explorer...
hope this helps you..
for further specification revert back..
Regards,
RK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have followed the tutorial exactly and infact repeated it several time but with exactly the same result at the end.
The link:
http://localhost:50000/Calculator/Calculator.jsp gives the following error below. Any input as to cause of problem appreciated.
regards - Tom
========
500 Internal Server Error
SAP J2EE Engine/6.30
Application error occurs during processing the request.
Details: java.lang.InstantiationException: ID018236: Cannot instantiate bean. java.lang.ClassNotFoundException: class com.sap.engine.examples.beans.calculator.CalcProxy : java.lang.Exception: Error instantiating Calculator EJBcom.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of : CalculatorBean
at jsp_Calculator1111662422326._jspService(jsp_Calculator1111662422326.java:2)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:466)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:363)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:222)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:301)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:682)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:220)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:94)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:142)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
web.xml
==========================
==========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>WEB APP</display-name>
<description>WEB APP description</description>
<servlet>
<servlet-name>Calculator.jsp</servlet-name>
<jsp-file>/Calculator.jsp</jsp-file>
</servlet>
<ejb-ref>
<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.sap.engine.examples.ejb.calculator.CalculatorHome</home>
<remote>com.sap.engine.examples.ejb.calculator.Calculator</remote>
<ejb-link>CalculatorBean</ejb-link>
</ejb-ref>
</web-app>
==========================
==========================
ejb-jar.xml
==========================
==========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<description>EJB JAR description</description>
<display-name>EJB JAR</display-name>
<enterprise-beans>
<session>
<ejb-name>CalculatorBean</ejb-name>
<home>com.sap.engine.examples.ejb.calculator.CalculatorHome</home>
<remote>com.sap.engine.examples.ejb.calculator.Calculator</remote>
<local-home>com.sap.engine.examples.ejb.calculator.CalculatorLocalHome</local-home>
<local>com.sap.engine.examples.ejb.calculator.CalculatorLocal</local>
<ejb-class>com.sap.engine.examples.ejb.calculator.CalculatorBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
==========================
==========================
web-j2ee-engine.xml
==========================
==========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-j2ee-engine SYSTEM 'web-j2ee-engine.dtd'>
<web-j2ee-engine />
==========================
==========================
ejb-j2ee.xml
==========================
==========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
<ejb-j2ee-engine>
<enterprise-beans>
<enterprise-bean>
<ejb-name>CalculatorBean</ejb-name>
<session-props/>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
Hi I have the same problem with the example in the book and you can see it by searching for "not found" in this forum. The example works as a web service but not via http://<localhost>:50000/employee/view.
Maybe you would find the same behavior - you define yours as a WS and it runs?
Best regards
I am having exactly the same problem with the Calculator tutorial. Could you advise how you solved the problem?
regards,
Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Neil,
from the error stack it seems, that the problem arises in your JNDI-Lookup.
You should have some code like (CalculatorProxy.java):
<i> /**
Performing look-up for the Calculator- HomeInterface/-RemoteInterface
"Instantiation" of a Calculator Bean.
*/
public void init() throws Exception
{
try
{
InitialContext ctx = new InitialContext();
<b>Object ob = ctx.lookup("java:comp/env/CalculatorBean");</b>
CalculatorHome home = ( CalculatorHome )
PortableRemoteObject.narrow(ob, CalculatorHome.class );
//Initialize the enterprise bean
calc = home.create();
}
...</i>
What you are doing in this code, is looking-up in the "yellow-pages" (which is JNDI in this case) for a certain Bean, referenced as: CalculatorBean.
This snippet implies, that you have the following statement at your web.xml file:
<i><web-app>
<display-name>WEB APP</display-name>
<description>WEB APP description</description>
<servlet>
<servlet-name>Calculator.jsp</servlet-name>
<jsp-file>/Calculator.jsp</jsp-file>
</servlet>
<b><ejb-ref>
<description>
</description>
<ejb-ref-name>CalculatorBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.sap.j2ee.ejb.session.CalculatorHome</home>
<remote>com.sap.j2ee.ejb.session.Calculator</remote>
<ejb-link>CalculatorBean</ejb-link>
</ejb-ref></b></web-app></i>
It is stated above, that there is a reference to a EJB, called CalculatorBean with the declared interfaces (and so on).
Might be worth to give it a try to look there, but <b>do not simply cut and paste from the snippets above</b> (as I might have changed the package statements "com.sap. ..." to something more suitable for me).
If it does not work after this check, come back again.
Cheers
Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.