[EJB 3.0] - Inject EJB 2.1 Entity Home into EJB 3.0 session beans using
by benwalker_vf
Hi,
Has anyone been able to inject a 2.1 entity bean home into 3.0 session bean using the @EJB annotation in jboss-5.0.0.Beta4?
I have tried the following (fairly sure it should work according to EJB3 spec)
Session Fragment: -
| @Stateless(name="ExampleService")
| @Local(ExampleService.class)
| @Remote(ExampleServiceRemote.class)
| @TransactionAttribute(REQUIRED)
| public class ExampleServiceBean implements ExampleService,ExampleServiceRemote,Serializable {
|
| private static final long serialVersionUID = -7533521006618484580L;
|
| @EJB
| private Example21EntityHome example21EntityHome;
|
| private static Logger logger = Logger.getLogger(ExampleServiceBean.class);
|
| /**
| * Does what ever you tell it too
| * @param whatToDo request text
| * @return string response text
| */
| public String doSomething(String whatToDo) {
|
|
| String doing = "doing " + whatToDo;
|
| try {
| example21EntityHome.create(doing);
| } catch (CreateException e) {
|
| logger.error("Unable to create 2.1 entity bean",e);
| }
|
| logger.info(doing);
| return doing;
|
| }
|
|
|
| }
Entity Fragment : -
| public abstract class Example21EntityBean extends EntityAdapter implements Serializable {
|
| public abstract Integer getPk();
|
| public abstract void setPk(Integer pk);
|
| public abstract String getData();
|
| public abstract void setData(String data);
|
| public Integer ejbCreate(String data) throws CreateException {
| // dummy, pk set by auto-generated-pk
| setPk(0);
| setData(data);
| return null;
| }
|
| public void ejbPostCreate(String data) {
| // empty implementation
|
| }
| }
2.1 Entity Bean Deployment Descriptor
| <?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>
| <display-name>Example 21 Legacy</display-name>
| <enterprise-beans>
| <entity>
| <ejb-name>Example21Entity</ejb-name>
| <local-home>com.entitybean21.Example21EntityHome</local-home>
| <local>com.entitybean21.Example21Entity</local>
| <ejb-class>com.entitybean21.Example21EntityBean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>java.lang.Integer</prim-key-class>
| <reentrant>false</reentrant>
| <abstract-schema-name>Example21Entity</abstract-schema-name>
| <cmp-field>
| <description>This is the PK</description>
| <field-name>pk</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>data</field-name>
| </cmp-field>
| <primkey-field>pk</primkey-field>
| </entity>
| </enterprise-beans>
| <assembly-descriptor>
| <container-transaction>
| <method>
| <ejb-name>Example21Entity</ejb-name>
| <method-name>create</method-name>
| </method>
| <trans-attribute>Required</trans-attribute>
| </container-transaction>
| <container-transaction>
| <method>
| <ejb-name>Example21Entity</ejb-name>
| <method-name>*</method-name>
| </method>
| <trans-attribute>Supports</trans-attribute>
| </container-transaction>
| </assembly-descriptor>
| </ejb-jar>
|
However, on deployment I get the following stack trace: -
| 17:13:58,517 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
|
| jboss.j2ee:ear=example.ear,jar=example-ejb.jar,name=ExampleService,service=EJB3
| -> <UNKNOWN>{Described:** UNRESOLVED Demands 'Class:com.entitybean21.Example21EntityHome **}
| -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService **}
|
|
| *** CONTEXTS IN ERROR: Name -> Error
|
| <UNKNOWN> -> ** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService **
|
NB Packaged as two ejb jar files in the same ear to get around issue posted @ http://www.jboss.org/?module=bb&op=viewtopic&t=103268
Has anyone tried to do something similar? Is this supported functionality?
Thanks
Ben
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134346#4134346
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134346
18 years, 1 month
[Tomcat, HTTPD, Servlets & JSP] - JvmRouteValve java.lang.StringIndexOutOfBoundsException!!!!
by java123
Following is the stack trace that we get when we make request for the same page on different environments:
[05-03-2008 11:33:39.483] [4130090] [org.apache.catalina.connector.CoyoteAdapter] [ERROR] [ajp-0.0.0.0-18249-1] An exception or error occurred in the contai
ner during the request processing
java.lang.StringIndexOutOfBoundsException: String index out of range: 54
at java.lang.String.substring(String.java:1765)
at org.jboss.web.tomcat.service.session.JvmRouteValve.handleJvmRoute(JvmRouteValve.java:128)
at org.jboss.web.tomcat.service.session.JvmRouteValve.checkJvmRoute(JvmRouteValve.java:112)
at org.jboss.web.tomcat.service.session.JvmRouteValve.invoke(JvmRouteValve.java:81)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:419)
at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:393)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1513)
at java.lang.Thread.run(Thread.java:595)
After little investigation it looks like in handleJvmRoute method when getting the receivedJvmRoute from the oldsessionId, substring method is using the length from the sessionId rather than the oldsessionId.
We are running with JBoss 4.2.1.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134343#4134343
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134343
18 years, 1 month
[JBoss jBPM] - Running Seam and JPBM in a separate schema
by Bas Rutten
Hi,
I'm using Seam 2.0.1.CR1 together with JBPM 3.2.2 and JTA. I want to keep the JBPM files in a separate database schema.
I've set up two persistence units (one for my application tables and one for JBPM) and this all seems to work fine; the JBoss 4.2.1 application server deploys my EAR file without any problems, and my jbpm process definition is correctly deployed to the database.
However, when I try to invoke any function that uses JBPM, I get the following error:
Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware
| object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to en
| list resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -79e42ac2:11ad:47ce
| d1cd:171 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceEx
| ception: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.
| transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warni
| ngs. tx=TransactionImple < ac, BasicAction: -79e42ac2:11ad:47ced1cd:171 status: ActionStatus.ABORT_O
| NLY >))
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94
| )
| at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionP
| rovider.java:69)
| at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
| ... 140 more
| Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering me
| ta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabl
| ed to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -79e42ac2:1
| 1ad:47ced1cd:171 status: ActionStatus.ABORT_ONLY >)
| at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxC
| onnectionManager.java:343)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(Ba
| seConnectionManager2.java:518)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnec
| tionManager2.java:399)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.alloca
| teConnection(BaseConnectionManager2.java:842)
| at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88
| )
| ... 142 more
| Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see t
| he previous warnings. tx=TransactionImple < ac, BasicAction: -79e42ac2:11ad:47ced1cd:171 status: Act
| ionStatus.ABORT_ONLY >
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$Transa
| ctionSynchronization.checkEnlisted(TxConnectionManager.java:744)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist
| (TxConnectionManager.java:577)
| at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxC
| onnectionManager.java:337)
| ... 146 more
|
I'm not sure what goes wrong here but it seems I cannot open a transaction or connection to the database that contains the jbpm files.
I tried to change the "isTransactionEnabled" attribute in the jbpm.cfg.xml file from "false" to "true" but if I do this Seam complains that I should change it back to "false".
My question: is it at all possible to use Seam + JBPM + JTA and have the JBPM data stored in a separate database schema? If so, how do I need to configure the configuration files like "jbpm.cfg.xml"???
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134342#4134342
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134342
18 years, 1 month
[JBoss jBPM] - Cannot deploy BPEL version of HelloWorld
by markld
Hello
I'm trying to deploy the HelloWorld sample that comes with jBPM BPEL. I've downloaded the latest JBoss AS and got it running. The database schema has been generated and I can see the web console.
But when I run "ant deploy.process" the console window I'm using says "deployment failed", and the AS window shows this:
13:13:23,795 ERROR [[deploymentServlet]] Servlet.service() for servlet deploymentServlet threw exception
javax.servlet.ServletException: parameter 'processArchive' is expected to have content type 'application/zip' or 'application/x-zip-compressed', found
: application/octet-stream
at org.jbpm.bpel.web.DeploymentServlet.parseProcessArchive(DeploymentServlet.java:138)
at org.jbpm.bpel.web.DeploymentServlet.parseRequest(DeploymentServlet.java:114)
at org.jbpm.bpel.web.DeploymentServlet.doPost(DeploymentServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)
I wondered if Ant might be the problem, as googling suggests problems with Ant and Zip.
I'm using Windows, by the way...
regards
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134337#4134337
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134337
18 years, 1 month