Hi Dale,
Can you give more information on your client application?
Also have a look at
http://cwiki.apache.org/confluence/display/GMOxDOC11/EJB+sample+application.
But it is not yet finished. Hope it this will help to you too.
Regards,
Lasantha Ranaweera
Senior Software Engineer,
Lanka Sofware Foundation,
Sri Lanka.
Dale de los Reyes wrote:
Hello,
I need some help. I've been having problems accessing an entity bean
from my session bean. I've coded similar EJBs before and they've
successfully run on Geronimo 1.0. I tried using the upgrade.jar
utility on these old beans, but was unable to get them to deploy. When
the example programs became available, I gave up trying to use the
upgrade tool. Now, the application seems to deploy just fine with no
error messages being returned in the console window, but there are
some debug messages in the log file.
When I access my application, the session bean seems to locate the
entity bean successfully. But when I call a method belonging to that
entity bean, I get a "SystemExceptionInterceptor" warning. I'm not
sure what this means, other than I'm doing something wrong.
I'm using Geronimo 1.1 with Tomcat and Java 1.4.2_10. The descriptor
files are modelled after the Bank demo supplied in the user manual
which I was able to get running. My test application is deployed as an
ear file via Hot Deployer.
The descriptor files (ejb-jar.xml, openejb-jar.xml) and stack trace
are below for my test application. I hope someone can point out what
I'm missing or doing wrong.
Thanks,
Dale
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>
<enterprise-beans>
<session>
<ejb-name>ProcessCustomerSessionBean</ejb-name>
<home>com.service.customer.ejb.ProcessCustomerHome</home>
<remote>com.service.customer.ejb.ProcessCustomer</remote>
<ejb-class>com.service.customer.ejb.ProcessCustomerSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/CustomerHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.service.customer.ejb.CustomerHome</home>
<remote>com.service.customer.ejb.Customer</remote>
<ejb-link>CustomerEntityBean</ejb-link>
</ejb-ref>
</session>
<entity>
<ejb-name>CustomerEntityBean</ejb-name>
<home>com.service.customer.ejb.CustomerHome</home>
<remote>com.service.customer.ejb.Customer</remote>
<ejb-class>com.service.customer.ejb.CustomerEntityBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/CustomerServiceDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ProcessCustomerSessionBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
*****
openejb-jar.xml
---------------
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">
<dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CustomerService-ejb</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>jar</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>CustomerServicePool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
<dep:hidden-classes/>
<dep:non-overridable-classes/>
</dep:environment>
<enterprise-beans>
<session>
<ejb-name>ProcessCustomerSessionBean</ejb-name>
<jndi-name>ProcessCustomerRemoteSessionBean</jndi-name>
<ejb-ref>
<ref-name>ejb/CustomerHome</ref-name>
<ejb-link>CustomerEntityBean</ejb-link>
</ejb-ref>
</session>
<entity>
<ejb-name>CustomerEntityBean</ejb-name>
<jndi-name>CustomerRemoteEntity</jndi-name>
<resource-ref>
<ref-name>jdbc/CustomerServiceDataSource</ref-name>
<resource-link>CustomerServicePool</resource-link>
</resource-ref>
</entity>
</enterprise-beans>
</openejb-jar>
*****
This stack trace is taken from "geronimo-1.1/var/log/geronimo.log"
09:28:35,491 DEBUG [GBeanSingleReference] Waiting to start
default/CustomerService/1.0/ear?J2EEApplication=default/CustomerService/1.0/ear,j2eeType=EJBModule,name=CustomerService-ejb.jar
because no targets are running for reference J2EEApplication matching
the patterns
default/CustomerService/1.0/ear?j2eeType=J2EEApplication,name=default/CustomerService/1.0/ear
09:28:35,631 DEBUG [GBeanSingleReference] Waiting to start
default/CustomerService/1.0/ear?J2EEApplication=default/CustomerService/1.0/ear,j2eeType=EJBModule,name=PubQueryEJB.jar
because no targets are running for reference J2EEApplication matching
the patterns
default/CustomerService/1.0/ear?j2eeType=J2EEApplication,name=default/CustomerService/1.0/ear
09:29:19,985 WARN [SystemExceptionInterceptor] CustomerEntityBean
javax.transaction.TransactionRolledbackException:
com.service.customer.ejb.CustomerEntityBean
at
org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:126)
at
org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
at
org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
at
org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
at
org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:164)
at
org.openejb.proxy.EntityEJBHome$$EnhancerByCGLIB$$d8dd02dd.findByAll(<generated>)
at
com.service.customer.ejb.ProcessCustomerSessionBean.findAllCustomers(ProcessCustomerSessionBean.java:70)
at
com.service.customer.ejb.ProcessCustomerSessionBean$$FastClassByCGLIB$$5aed4974.invoke(<generated>)
at
org.openejb.dispatch.AbstractMethodOperation.invoke(AbstractMethodOperation.java:90)
at org.openejb.slsb.BusinessMethod.execute(BusinessMethod.java:67)
at
org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
at
org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
at
org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
at
org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)
at
org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
at
org.openejb.slsb.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:98)
at
org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:140)
at
org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
at
org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
at
org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
at
org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:164)
at
org.openejb.proxy.SessionEJBObject$$EnhancerByCGLIB$$ba84632c.findAllCustomers(<generated>)
at
com.service.customer.web.CustomerServiceJavaBean.getAllCustomers(CustomerServiceJavaBean.java:94)
at
org.apache.jsp.customers.index_jsp._jspService(org.apache.jsp.customers.index_jsp:81)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:46)
at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:342)
at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)