[Beginner's Corner] - From Tomcat 6 Spring/JPA/JTA to JBoss EAP 5.1.0
by Fabio Schmitz Tani
Fabio Schmitz Tani [http://community.jboss.org/people/fstani] created the discussion
"From Tomcat 6 Spring/JPA/JTA to JBoss EAP 5.1.0"
To view the discussion, visit: http://community.jboss.org/message/563821#563821
--------------------------------------------------------------
First of all I'd like to introduce myself, I'm new to posting in this community although I have worked with JBoss AS in the past, in versions 3 and 4, and more recently with Mobicents Sip Servlet with JBoss 4.
For the past month I've had my first contacts with JBoss AS 5, I was given the task of researching and documenting migration paths from applications deployed in Tomcat 6 to the JBoss AS 5, since the company I'm working for is planning on moving applications from some other application servers including Tomcat 6 (which I know it is not a valid JEE 5 container) and Oracle WebLogic.
Most of their applications so far didn't have the need of a JEE 5 application server, but recently some applications have been leveraging third party libraries to emulate a JEE 5 environment inside tomcat, so the decision was made to instead try to put everything in a more homogeneous environment.
So far I've been able to overcome most of my problems with some research and testing of environments, but I'm still not there. I am trying to migrate the most recent application that was developed, trying to change mostly the xml configurations and the environment, in order not to generate re-work to the source code of this applications, at least not in an initial phase anyways.
So getting to the questions, I have had some success configuring some various steps, such as ClassLoading, VFS, Weaving with Snowdrop, TransactionManagement (sort of) with JBoss and JTA.
I think I've covered a lot of ground getting information that was already answered and reading historic links here and there, but I think I'm getting to a point where I would really need to interact with the people who know JBoss the most, since I've been getting to a point where the information I'm getting is either old or outdated. And I'm stumbling on documentation and examples that are probably still linked by google but are probably not the current information on the subject.
So, right now what I'm trying to solve is working with multiple datasources in a transactional environment with two phase commit.
The basic application background is:
JBoss As 5.1.0
Hibernate 3.3.1 - using ClassLoad isolation
Spring 2.5.6 + Snowdrop 1.0.1 GA - to fix VFS and Weaving
JTA (In Tomcat was done using JoTM, in JBoss 5 switched to JBossTS)
MyFaces 1.2.6 + RichFaces 3.0.0 - using the JSF implementation from the WAR, configured in web.xml
>From what I've been able to dig up so far, JBoss 5, which uses JBossTS, does not support using multiple local-tx-datasources in a war, this being because the old method is broken and does not guarantee ACID, so basically, in the past it was possible to use it like this but it would result in errors, so now it is blocked from being possible to even do this type of configuration.
Ok, so the solution that is pointed is to use XA, luckily for me the underlying database is Oracle 10g, so we are able to switch to Oracle XA drivers, so with this I've looked up how to properly set up XA Datasources with Oracle, unfortunately the documentation and the examples include some hints, which appear to be old or not longer needed (You can see it here in this thread: http://community.jboss.org/thread/156044 http://community.jboss.org/thread/156044).
And I think that's where I'm hitting a wall, I'll post the code for the old local-tx-datasources that would start the application ok, but would throw the two phase commit problem:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/Datasource1DS</jndi-name>
<rar-name>jboss-local-jdbc.rar</rar-name>
<use-java-context>true</use-java-context>
<connection-definition>javax.sql.DataSource</connection-definition>
<jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>30</idle-timeout-minutes>
<prefill>false</prefill>
<background-validation>false</background-validation>
<background-validation-millis>0</background-validation-millis>
<validate-on-match>true</validate-on-match>
<statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
<isSameRM-override-value>false</isSameRM-override-value>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
<security-domain-and-application xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
<local-transaction/>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<user-name>userName</user-name>
<password>passWd</password>
<check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
<set-tx-query-timeout>false</set-tx-query-timeout>
<query-timeout>0</query-timeout>
<use-try-lock>60000</use-try-lock>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@oracle-db:1521:schema</connection-url>
</local-tx-datasource>
</datasources>
I have two other datasources which have a similar configuration with different schema / username and passwords, and JNDI name.
So from that I converted it, according to documentation and other threads to:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasources>
<xa-datasource>
<jndi-name>jdbc/Datasource1DS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">
jdbc:oracle:thin:@oracle-db:1521:schema
</xa-datasource-property>
<xa-datasource-property name="User">userName</xa-datasource-property>
<xa-datasource-property name="Password">pwd</xa-datasource-property>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<no-tx-separate-pools/>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</xa-datasource>
<xa-datasource>
<jndi-name>jdbc/Datasource2DS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">
jdbc:oracle:thin:@oracle-db:1521:schema
</xa-datasource-property>
<xa-datasource-property name="User">userName2</xa-datasource-property>
<xa-datasource-property name="Password">pwd2</xa-datasource-property>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<no-tx-separate-pools/>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</xa-datasource>
<xa-datasource>
<jndi-name>jdbc/Datasource3DS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">
jdbc:oracle:thin:@oracle-db:1521:schema
</xa-datasource-property>
<xa-datasource-property name="User">userName3</xa-datasource-property>
<xa-datasource-property name="Password">pwd3</xa-datasource-property>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<no-tx-separate-pools/>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</xa-datasource>
<mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter" name="jboss.jca:service=OracleXAExceptionFormatter">
<depends optional-attribute-name="TransactionManagerService">
jboss:service=TransactionManager
</depends>
</mbean>
</datasources>
I've added all the DS in a single file because of the mbean declaration, which JBoss would complain to be duplicated if I had multiple *-ds.xml files.
Anyways, what happens is that when the application tries to get a connection from the pool, an execption is thrown:
Caused by: javax.resource.ResourceException: Unable to get managed connection for jdbc/DataSource1DS
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:441)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:413)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
... 129 more
Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Invalid argument(s) in call)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:465)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:409)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
... 133 more
Caused by: java.sql.SQLException: Invalid argument(s) in call
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:96)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:449)
... 138 more
I've searched a little for solutions but no answer still, the documentation recommends adding a property called Pad = true, on a mbean which appears not to exist on jboss-service.xml, this appears to be stale documentation, I've read somewhere that now it is already set as true by default, but I don't remember where exactly I've read it.
Anyways what I aim is to be able to discuss this issue with the community, and as it goes on I could post the solutions I've found over here, they may be particular to my application or they may be general enough as to help someone else, as some countless others I've found have helped.
Anyone who can throw in their two cents is welcome.
Thanks in advance,
And sorry for doing a long post :D
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/563821#563821]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[jBPM] - jBPM console throws com.google.gwt.http.client.RequestException
by Adel Haider
Adel Haider [http://community.jboss.org/people/delinhos] created the discussion
"jBPM console throws com.google.gwt.http.client.RequestException"
To view the discussion, visit: http://community.jboss.org/message/563948#563948
--------------------------------------------------------------
*=== Environment ==============================*
- *jBPM Version*: 4.4
- *Database*: inbuilt hsqldb
- *JDK*: 1.6
- *Container*: jBoss
- *Configuration*: jbpm.cfg.xml only importing files from the jbpm.jar lib itself
- *Libraries*: using the exact versions of the libs from inside the jbpm distribution
*=== Process ==================================*
<process name="sidns" xmlns=" http://jbpm.org/4.4/jpdl http://jbpm.org/4.4/jpdl">
<variable init-expr="#{variavel}" name="content" type="string"/>
<!--<assign name='assign1' from-expr='#{variavel}' to-expr='#{content}'>
<transition name='to start' to='start1'/>
</assign>-->
<!--<assign name='assign1' to-var='content'>
<from><string value="java2"/></from>
<transition name='to start' to='start1'/>
</assign>-->
<start g="9,75,48,48" name="start1">
<transition g="-22,-20" name="to decision" to="decision1"/>
</start>
<end g="406,80,48,48" name="end1"/>
<java class="pt.fccn.sidns.SIDNS" g="234,22,92,52" method="writeToFile" name="java1">
<arg>
<string value="file1.txt"/>
</arg>
<transition g="-15,-20" name="to end1" to="end1"/>
</java>
<java class="pt.fccn.sidns.SIDNS" g="237,144,92,52" method="writeToFile" name="java2">
<arg>
<string value="file2.txt"/>
</arg>
<transition g="-83,14" name="to send rectify note" to="send rectify note"/>
</java>
<decision g="109,77,48,48" name="decision1">
<transition g="-46,-20" name="to java1" to="java1">
<condition expr="#{content=="java1"}"/>
</transition>
<transition g="-38,3" name="to java2" to="java2">
<condition expr="#{content=="java2"}"/>
</transition>
</decision>
<mail g="379,171,115,45" name="send rectify note">
<to addresses=" mailto:name@domain.com name(a)domain.com"/>
<!--<cc groups="innerparty" users="bb"/>-->
<!--<bcc groups="thinkpol"/>-->
<subject>assunto</subject>
<text>body</text>
<!--
<html><table><tr><td>${newspaper}</td><td>${date}</td>
<td>reporting bb dayorder doubleplusungood
refs unpersons rewrite fullwise upsub antefiling</td>
</tr></table></html>
<attachments>
<attachment url=' http://www.george-orwell.org/1984/3.html http://www.george-orwell.org/1984/3.html' />
<attachment resource='org/example/pic.jpg' />
<attachment file='${user.home}/.face' />
</attachments>
-->
<transition g="-45,-20" name="to end1" to="end1"/><!--language="juel"-->
</mail>
</process>
*=== API ===================================*
Invoking through jBPM console.
*=== Stacktrace ==============================*
2010-09-28 16:37:10,479 [DEBUG] POST: http://localhost:8080/gwt-console-server/rs/process/definition/sidns-1/ne... http://localhost:8080/gwt-console-server/rs/process/definition/sidns-1/ne...
2010-09-28 16:37:10,539 [ERROR] <ul><li>URL: ' http://localhost:8080/gwt-console-server/rs/process/definition/sidns-1/ne... http://localhost:8080/gwt-console-server/rs/process/definition/sidns-1/ne...'
<li>Action: 'org.jboss.bpm.console.client.process.StartNewInstanceAction'
<li>Exception: 'class com.google.gwt.http.client.RequestException'</ul>
HTTP 500: Unknown error
com.google.gwt.http.client.RequestException:
HTTP 500: Unknown error
at Unknown.zP(Unknown source:0)
at Unknown.szc(Unknown source:0)
at Unknown.KO(Unknown source:0)
at Unknown.pP(Unknown source:0)
at Unknown.anonymous(Unknown source:0)
at Unknown.HA(Unknown source:0)
at Unknown.anonymous(Unknown source:0)
at Unknown.anonymous(Unknown source:0)
*=== Debug logs ==============================*
16:37:10,486 INFO [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd@167c24a
javax.el.PropertyNotFoundException: Cannot resolve identifier 'variavel'
at de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:86)
at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:51)
at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:28)
at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)
at org.jbpm.pvm.internal.el.UelValueExpression.evaluateInScope(UelValueExpression.java:52)
at org.jbpm.pvm.internal.model.VariableDefinitionImpl.getInitValue(VariableDefinitionImpl.java:55)
at org.jbpm.pvm.internal.model.ScopeInstanceImpl.initializeVariables(ScopeInstanceImpl.java:84)
at org.jbpm.pvm.internal.model.ExecutionImpl.initializeScopes(ExecutionImpl.java:237)
at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:213)
at org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:60)
at org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:37)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:83)
at org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:62)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceById(ExecutionServiceImpl.java:51)
at org.jbpm.integration.console.ProcessManagementImpl.newInstance(ProcessManagementImpl.java:139)
at org.jboss.bpm.console.server.ProcessMgmtFacade.newInstance(ProcessMgmtFacade.java:204)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
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:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
16:37:10,491 ERROR [SynchronousDispatcher] failed to execute
*=== Problem description =========================*
When invoking any process from the jBPM console, if the process itself throws an exception at runtime (Debug logs), the console displays a window with the *Stacktrace* showed above (printscreen attached). This occurs regardless of the error that occurred within the process and the process being invoked.
NB: The problem I'm trying to report is *NOT* the exception described in the Debug log, it's the exception thrown in the console due to the error in the process.
I have been through the jBPM wiki, user forums, etc. but nothing addresses this issue concretely. What is the cause of this exception and how do I fix it?
Kind Regards,
Adel Haider
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/563948#563948]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[jBPM] - Re: Find Members of a Group for Auto-Assigning a Task
by Jimmy Smith
Jimmy Smith [http://community.jboss.org/people/swd_eagle] created the discussion
"Re: Find Members of a Group for Auto-Assigning a Task"
To view the discussion, visit: http://community.jboss.org/message/563865#563865
--------------------------------------------------------------
You'll have to do this in an AssignmentHandler, but should be pretty easy.
You will have to look at the IdentityService and providing your custom implementation of that.
Specifically, you will need to implement:
public List<User> findUsersByGroup(String groupId)
to get the users in your group. Once you have those, you can easily use:
taskService.findPersonalTasks(user)
to get the tasks for every user in the group and assign your new task to the user with the fewest tasks.
When automatically assigning tasks, you also have to have a mechanism that checks that the user is capable of processing the task. Its no use assigning tasks to a user who just went on a 6-month maternaty leave! Typically we try to avoid auto-assigning of tasks. But we do have proper reporting that indicates which tasks are left unattended and which users are underperforming.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/563865#563865]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months