Please help: Exception in running the application
Hello All,
I created one Stateless Session bean and one entity bean. I am trying to access the entity bean from the SLS bean, by doing like..
public Vector getConfigData(String installID) throws RemoteException {
System.out.println("--> Entering: ConverterBean.getConfigData() ");
System.out.println("--> InstallID passed is: " + installID);
Vector v = new Vector();
try {
AccountLocal configs = AccountHome.findByPrimaryKey(installID);
v.addElement(configs.getInstallId());
v.addElement(configs.getInstallOwner());
v.addElement(configs.getUnitId());
v.addElement(configs.getInstallDesc());
} catch (FinderException fe) {
//throw new AccountException(fe.getMessage());
System.out.println("Exception caught");
}
System.out.println("<-- Leaving: UploadMgrBean.getInstallIDs ");
return v;
}
I have two DD one for session and one for Entity here they are:
For Entity--
<?xml version='1.0' encoding='UTF-8'?>
<ejb-jar
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
>
<display-name>AccountJAR</display-name>
<enterprise-beans>
<entity>
<display-name>AccountBean</display-name>
<ejb-name>AccountBean</ejb-name>
<home>beans.AccountHome</home>
<remote>beans.Account</remote>
<local-home>beans.AccountLocalHome</local-home>
<local>beans.AccountLocal</local>
<ejb-class>beans.AccountBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Account</abstract-schema-name>
<cmp-field>
<description>no description</description>
<field-name>installId</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>unitId</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>installOwner</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>installDesc</field-name>
</cmp-field>
<primkey-field>installId</primkey-field>
<ejb-ref>
<ejb-ref-name>ejb/AccounEntityBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>beans.AccountHome</home>
<remote>beans.Account</remote>
<ejb-link>ejb-jar-ic1.jar#AccountBean</ejb-link>
</ejb-ref>
<security-identity>
<use-caller-identity>
</use-caller-identity>
</security-identity>
</entity>
</enterprise-beans>
</ejb-jar>
============
For Session
===========
<?xml version='1.0' encoding='UTF-8'?>
<ejb-jar
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
>
<display-name>ConverterJAR</display-name>
<enterprise-beans>
<session>
<display-name>ConverterBean</display-name>
<ejb-name>ConverterBean</ejb-name>
<home>beans.ConverterHome</home>
<remote>beans.Converter</remote>
<ejb-class>beans.ConverterBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/TheAccountStatus</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>beans.ConverterHome</home>
<remote>beans.Converter</remote>
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/AccountEntityBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>beans.AccountLocalHome</local-home>
<local>beans.AccountLocal</local>
<ejb-link>ejb-jar-ic1.jar#AccountBean</ejb-link>
</ejb-local-ref>
<security-identity>
<use-caller-identity>
</use-caller-identity>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked>
</unchecked>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>dollarToYen</method-name>
<method-params>
<method-param>java.math.BigDecimal</method-param>
</method-params>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>yenToEuro</method-name>
<method-params>
<method-param>java.math.BigDecimal</method-param>
</method-params>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getConfigData</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
</method-permission>
<method-permission>
<unchecked>
</unchecked>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
</method>
<method>
<ejb-name>ConverterBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
</method>
</method-permission>
</assembly-descriptor>
</ejb-jar>
=======
when I run my jsp page, I am getting following exception in the server.log file.
[#|2006-08-16T13:23:49.060-0400|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=23;|EJB5018: An exception was thrown during an ejb invocation on [ConverterBean]|#]
[#|2006-08-16T13:23:49.060-0400|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=23;|
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:2807)
at com.sun.ejb.containers.BaseContainer.checkExceptionNoTx(BaseContainer.java:2647)
at com.sun.ejb.containers.BaseContainer.checkExceptionBeanMgTx(BaseContainer.java:2585)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:2485)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:819)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:137)
at $Proxy99.getConfigData(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:167)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
at beans._Converter_DynamicStub.getConfigData(_Converter_DynamicStub.java)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Caused by: java.lang.NullPointerException
at beans.ConverterBean.getConfigData(ConverterBean.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
... 44 more
|#]
============
Can you please help me what I am doing wrong? I would really appreciate if you guys help me. Exception is on line AccountLocal configs = AccountHome.findByPrimaryKey(installID);I do not know why..

