tags:

views:

180

answers:

1

Hello! I am following this example . I keep getting this error whenever calling upon find: java.lang.NullPointerException at LoginAction.service(LoginAction.java:41) at Dispatcher.doWork(Dispatcher.java:82) at Dispatcher.doGet(Dispatcher.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

I have no idea where to start looking. The 41th line is operator.findOperator(1), where @EJB private OperatorBeanService operator;

I'm trying to do this on a Glassfish 2.1. This is the persistence:

<persistence-unit name="persistMe" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>jdbc/peciu</jta-data-source> <properties> <property name="eclipselink.jdbc.batch-writing" value="JDBC"/> <property name="eclipselink.target-database" value="myDB"/> <property name="eclipselink.target-server" value="host"/> <property name="eclipselink.logging.level" value="ALL"/> </properties> </persistence-unit>

I've tried a separate JPA project with this persistence: <persistence-unit name="OperatorService" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>Operator</class> <properties> <property name="eclipselink.jdbc.batch-writing" value="JDBC"/> <property name="eclipselink.jdbc.driver" value="COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver"/> <property name="eclipselink.jdbc.url" value="jdbc:db2://host:50000/myDB"/> <property name="eclipselink.jdbc.user" value="user"/> <property name="eclipselink.jdbc.password" value="pass"/> </properties> </persistence-unit> and it worked just fine, returning the result from the OPERATOR table. I don't know what I'm missing. Thank you for your time. Iulia

A: 

You need to figure out why your OperatorBeanService isn't being injected(@EJB annotation).

I'm slightly confused though, you are following a WebSphere tutorial/example using glassfish? Perhaps you could try this with WAS to see if it works? Sorry about the non-answer answer, but I don't have much to go off.

-Rick

Rick
Thank you for your time.And you were right, the injection wasn't correct.I am using glassfish because it's easier to install and because all my attempts at trying to configure eclipse with websphere ended in an epic fail. What helped me in the end was this little article: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB
Iulia