cancel
Showing results for 
Search instead for 
Did you mean: 

Not Run first project in J2EE, the Calculator Application

Former Member
0 Kudos

I created my first project in J2EE, the Calculator Application. I followed tutorial the available one all in: http://help.sap.com/saphelp_nw04/helpdata/en/7d/cf0c8abcc34594ba9d3bbd5dd22155/frameset.htm

I obtained to publish the application but when I was to execute gave the following error:

Details: java.lang.InstantiationException: ID018236: Cannot instantiate bean. java.lang.ClassNotFoundException: class com.sap.examples.calculator.beans.CalcProxy : java.lang.Exception: Error instantiating Calculator EJBcom.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name webContainer/applications/sap.com/CalculatorEar/Calculator/java:comp/env/ejb/CalculatorBean, cannot resolve object reference. [Root exception is com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of CalculatorEjb.]

at jsp_Calculator1123589764696._jspService(jsp_Calculator1123589764696.java:6)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:537)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

thanks in Advanced

Accepted Solutions (1)

Accepted Solutions (1)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Marcos,

it seems your lookup is defined somehow wrong. Please check if you really do lookup "webContainer/applications/sap.com/CalculatorEar/Calculator/java:comp/env/ejb/CalculatorBean"

It should only be java:comp/env/ejb/CalculatorBean as far as I remember.

Regards,

Benny

Former Member
0 Kudos

Hi Benny

In the CalcProxy.java i have this lookup:

public class CalcProxy {

private Calculator calc;

public void init() throws Exception {

//Lookup the enterprise bean

try {

InitialContext ctx = new InitialContext();

<b>Object ob = ctx.lookup("java:comp/env/ejb/CalculatorBean");</b>

CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(ob, CalculatorHome.class);

//Initialize the enterprise bean

calc = home.create();

} catch (Exception e) {

throw new Exception(

"Error instantiating Calculator EJB" + e.toString());

}

}

Thanks in advanced,

Marcos

Message was edited by: Marcos Henrique Oliveira

Message was edited by: Marcos Henrique Oliveira

Former Member
0 Kudos

Hi Marcos,

can you please double check if you have set the refetence to the Calculator EJB correctly in the web.xml? A simple typo there could have caused that a different reference has been bound to the JNDI, and hence different lookup string to be used.

In addition, you can have a look at to find out how to check what reference is bound to the JNDI using the Visual Admin.

Hope that helps!

Answers (0)