I new to J2EE applications and the Orion server. I found a nice example on the web ( http://www.4degreez.com/intro_part_1.html ) that shows how to setup a J2EE application on Orion using the JDK tools. However, when I deploy the application and test it, I get the following error:
java.lang.NullPointerException
at /index.jsp._jspService/(/index.jsp.java:59) (JSP page line 38)
at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._ah._rad(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)].server.http.JSPServlet.service(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._cxb._abe(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._cxb._uec(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._twc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._io._gc(Unknown Source)
at com.evermind[Orion/1.5.2 (build 10460)]._if.run(Unknown Source)
Here is the code for the remote interface:
package orionapp.beans.Info;Here is the code for the home interface:import javax.ejb.EJBObject;
import java.rmi.RemoteException;public interface Info extends EJBObject
{
public String getMessage(String name) throws RemoteException;
}
package orionapp.beans.Info;Here is the code for the bean:import javax.ejb.*;
import java.io.Serializable;
import java.rmi.RemoteException;public interface InfoHome extends EJBHome
{
public Info create() throws CreateException, RemoteException;
}
package orionapp.beans.Info;Here is the code for the JSP:import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.InitialContext;public class InfoBean implements SessionBean
{
public String getMessage(String name)
{
String rtn = "Hello" + name + "!";
return rtn;
}
public void ejbCreate() { }
public void setSessionContext(SessionContext ctx) { }
public void ejbRemove() { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbLoad() { }
public void ejbStore() { }}
<%@ page import="It looks like iBean is still null, but why?
javax.naming.*,
javax.ejb.*,
java.rmi.*,
javax.rmi.PortableRemoteObject,
orionapp.beans.Info.*"
%><HTML><HEAD><TITLE>Test</TITLE></HEAD>
<BODY><%
// variables for the Info bean
InfoHome iHome = null;
Info iBean = null;
// check for form data
String name = request.getParameter("txtName");
// variable for String returned from Info bean
String msg = null;
// if form data was submitted...
if (name != null)
{
try
{
InitialContext ctx = new InitialContext();
iHome = (InfoHome)PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/orionapp/beans/Info"),
InfoHome.class);
iBean = iHome.create();
}
catch (Exception e)
{
e.printStackTrace();
}
msg = iBean.getMessage(name); // THIS IS THE LINE INDICATED BY THE ERROR MESSAGE!!!
%>Here is your message: <%= msg %>
<%
} // end if (name != null)
else
{
%>
<FORM METHOD="get" ACTION="index.jsp">
<BR>Enter your name: <INPUT TYPE="text" name="txtName"<BR>
<INPUT TYPE="submit" value="Submit"><BR>
</FORM>
<%
} // end else
%></BODY></HTML>
Thanks in advance,
Mo