[JCA/JBoss] - Re: Opening connection from a marked rollback tx
by oglueck
Yes, that's what I expected (that connections are stored in the tx). Hibernate (EJB3) is the one requesting the connection. I am not doing this explicitly there. I might open a connection from the same DS explicitly in another place (within this tx) and then call close() when done. But that should be fine I guess. Of course all work is done in one big tx. It is opened via a UserTransaction from a BMT session bean. The problem occurs before the call returns to the bean that started the tx.
Maybe there is a bug in an interceptor, so the tx is lost in the TransactionLocale?
Anyway, yes we are drifting away from the problem. I still think it is perfectly legal to open as many connections as I like even if the current tx is set rollback-only. I guess the rollback-only flag is only set in the transaction manager and the connection is completely unaware of this fact until the transaction manager performs the rollback at the end.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104552#4104552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104552
18 years, 8 months
[JBoss Seam] - Seam 2 shutdown exception
by pbrewer_uk
I'm using Seam 2.0.0.GA on JBoss 4.2.1.GA and have discovered that when I include seam-pdf.jar (with jfreechart.jar and jcommon.jar) in the ear's lib directory, and then press ctrl+c to shutdown JBoss I get the following error:
| 13:16:45,817 ERROR [STDERR] Exception in thread "AWT-Windows"
| 13:16:45,818 ERROR [STDERR] java.lang.IllegalStateException: Shutdown in progress
| 13:16:45,819 ERROR [STDERR] at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39)
| 13:16:45,820 ERROR [STDERR] at java.lang.Runtime.addShutdownHook(Runtime.java:192)
| 13:16:45,821 ERROR [STDERR] at sun.awt.windows.WToolkit.run(WToolkit.java:276)
| 13:16:45,822 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
|
However, if I remove seam-pdf.jar, jfreechart.jar and jcommon.jar from the ear's lib dir, the JBoss shuts down correctly.
Any ideas?
Thanks in advance, Pete.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104550#4104550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104550
18 years, 8 months
[JCA/JBoss] - Re: Opening connection from a marked rollback tx
by vickyk
"oglueck" wrote : Maybe the connection somehow doesn't get returned to the pool in time or something.
Subsequent Connections are taken from the TransactionLocal and not from the Pool , here is the code
| public ConnectionListener getConnection(Transaction trackByTransaction, Subject subject, ConnectionRequestInfo cri)
| throws ResourceException
| {
| // Determine the pool key for this request
| boolean separateNoTx = false;
| if (noTxSeparatePools)
| separateNoTx = clf.isTransactional();
| Object key = getKey(subject, cri, separateNoTx);
| SubPoolContext subPool = getSubPool(key, subject, cri);
|
| InternalManagedConnectionPool mcp = subPool.getSubPool();
|
| // Are we doing track by connection?
| TransactionLocal trackByTx = subPool.getTrackByTx();
|
| // Simple case
| if (trackByTransaction == null || trackByTx == null)
| {
| ConnectionListener cl = mcp.getConnection(subject, cri);
| if (traceEnabled)
| dump("Got connection from pool " + cl);
| return cl;
| }
|
| // Track by transaction
| try
| {
| trackByTx.lock(trackByTransaction);
| }
| catch (Throwable t)
| {
| JBossResourceException.rethrowAsResourceException("Unable to get connection from the pool for tx=" + trackByTransaction, t);
| }
| try
| {
| // Already got one
| ConnectionListener cl = (ConnectionListener) trackByTx.get(trackByTransaction);
| if (cl != null)
| {
| if (traceEnabled)
| dump("Previous connection tracked by transaction " + cl + " tx=" + trackByTransaction);
| return cl;
| }
| }
| finally
| {
| trackByTx.unlock(trackByTransaction);
| }
|
| // Need a new one for this transaction
| // This must be done outside the tx local lock, otherwise
| // the tx timeout won't work and get connection can do a lot of other work
| // with many opportunities for deadlocks.
| // Instead we do a double check after we got the transaction to see
| // whether another thread beat us to the punch.
| ConnectionListener cl = mcp.getConnection(subject, cri);
| if (traceEnabled)
| dump("Got connection from pool tracked by transaction " + cl + " tx=" + trackByTransaction);
|
| // Relock and check/set status
| try
| {
| trackByTx.lock(trackByTransaction);
| }
| catch (Throwable t)
| {
| mcp.returnConnection(cl, false);
| if (traceEnabled)
| dump("Had to return connection tracked by transaction " + cl + " tx=" + trackByTransaction + " error=" + t.getMessage());
| JBossResourceException.rethrowAsResourceException("Unable to get connection from the pool for tx=" + trackByTransaction, t);
| }
| try
| {
| // Check we weren't racing with another transaction
| ConnectionListener other = (ConnectionListener) trackByTx.get(trackByTransaction);
| if (other != null)
| {
| mcp.returnConnection(cl, false);
| if (traceEnabled)
| dump("Another thread already got a connection tracked by transaction " + other + " tx=" + trackByTransaction);
| return other;
| }
|
| // This is the connection for this transaction
| cl.setTrackByTx(true);
| trackByTx.set(cl);
| if (traceEnabled)
| dump("Using connection from pool tracked by transaction " + cl + " tx=" + trackByTransaction);
| return cl;
| }
| finally
| {
| trackByTx.unlock(trackByTransaction);
| }
| }
|
If you enabled track-connection-by-tx and you are getting the connections in applicaition in a transaction then the underlying connection should be same .
You can try this code
| InitialContext context = new InitialContext();
| DataSource ds = (DataSource)context.lookup("java:XAOracleDS");
| //UserTransaction utx = (UserTransaction)context.lookup("UserTransaction");
| //utx.begin();
| Connection con = ds.getConnection();
| Connection con1 = ds.getConnection();
| WrappedConnection wrap = (WrappedConnection)con;
| WrappedConnection wrap1 = (WrappedConnection)con1;
| out.println("UnderlyingConnection is :---> "+wrap.getUnderlyingConnection()+"<br>");
| out.println("Underlying Connection "+wrap1.getUnderlyingConnection()+"<br>");
| //utx.commit();
| con.close();
| con1.close();
|
In the above code the underlying connections would be different because the transaction related code is commented , if you uncomment that part it will give you same underlying connection.
So make sure that the part of code which is giving you different result is in transaction .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104540#4104540
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104540
18 years, 8 months
[JBoss AOP] - Re: Maven 2 plugin?
by legolas
Hi,
I am trying to use your plugin but run into problems. I get the following when running mvn process-classes -X:
[INFO] [jbossaop:compile {execution: default}]
| CLASSPATH: \DataDisk\var\m2\repository\concurrent\concurrent\1.3.4\concurrent-1.3.4.jar;
| \DataDisk\var\m2\repository\jboss\jboss-common-logging-spi\2.0.4.GA\jboss-common-logging-spi-2.0.4.GA.jar;
| \DataDisk\var\m2\repository\qdox\qdox\1.6\qdox-1.6.jar;
| \DataDisk\var\m2\repository\apache-httpclient\commons-httpclient\2.0.2\commons-httpclient-2.0.2.jar;
| \DataDisk\var\m2\repository\org\jboss\javassist\3.6.0.GA\javassist-3.6.0.GA.jar;
| \DataDisk\var\m2\repository\apache-xerces\xml-apis\2.7.1\xml-apis-2.7.1.jar;
| \DataDisk\var\m2\repository\ant\ant\1.6.5\ant-1.6.5.jar;
| \DataDisk\var\m2\repository\trove\trove\2.1.1\trove-2.1.1.jar;
| \DataDisk\var\m2\repository\org\jboss\aop\jboss-aop\2.0.0.beta1\jboss-aop-2.0.0.beta1.jar;
| \DataDisk\var\m2\repository\apache-slide\webdavlib\2.0\webdavlib-2.0.jar;
| \DataDisk\var\m2\repository\org\codehaus\plexus\plexus-utils\1.4.2\plexus-utils-1.4.2.jar;
| \DataDisk\var\m2\repository\org\jboss\jboss-common-core\2.2.1.GA\jboss-common-core-2.2.1.GA.jar;
| C:\usr\Java\maven-2.0.7\bin\..\lib\maven-core-2.0.7-uber.jar;
| C:\usr\Java\maven-2.0.7\bin\..\lib\maven-core-2.0.7-uber.jar;
| C:\DataDisk\Workspaces\Amf\product_java_jboss_NodeAgent\target\classes
| [DEBUG] Executing aopc: cmd.exe /X /C '"
| java -cp \DataDisk\var\m2\repository\concurrent\concurrent\1.3.4\concurrent-1.3.4.jar;
| \DataDisk\var\m2\repository\jboss\jboss-common-logging-spi\2.0.4.GA\jboss-common-logging-spi-2.0.4.GA.jar;
| \DataDisk\var\m2\repository\qdox\qdox\1.6\qdox-1.6.jar;
| \DataDisk\var\m2\repository\apache-httpclient\commons-httpclient\2.0.2\commons-httpclient-2.0.2.jar;
| \DataDisk\var\m2\repository\org\jboss\javassist\3.6.0.GA\javassist-3.6.0.GA.jar;
| \DataDisk\var\m2\repository\apache-xerces\xml-apis\2.7.1\xml-apis-2.7.1.jar;
| \DataDisk\var\m2\repository\ant\ant\1.6.5\ant-1.6.5.jar;
| \DataDisk\var\m2\repository\trove\trove\2.1.1\trove-2.1.1.jar;
| \DataDisk\var\m2\repository\org\jboss\aop\jboss-aop\2.0.0.beta1\jboss-aop-2.0.0.beta1.jar;
| \DataDisk\var\m2\repository\apache-slide\webdavlib\2.0\webdavlib-2.0.jar;
| \DataDisk\var\m2\repository\org\codehaus\plexus\plexus-utils\1.4.2\plexus-utils-1.4.2.jar;
| \DataDisk\var\m2\repository\org\jboss\jboss-common-core\2.2.1.GA\jboss-common-core-2.2.1.GA.jar;
| C:\usr\Java\maven-2.0.7\bin\..\lib\maven-core-2.0.7-uber.jar;
| C:\usr\Java\maven-2.0.7\bin\..\lib\maven-core-2.0.7-uber.jar;
| C:\DataDisk\Workspaces\Amf\product_java_jboss_NodeAgent\target\classes
| org.jboss.aop.standalone.Compiler
| -verbose
| -aoppath src/test/resources/META-INF/binding-manager-aop.xml
| C:\DataDisk\Workspaces\Amf\product_java_jboss_NodeAgent\target\classes\org\epo\product\jboss\nodeagent\bindingmanager\impl\ApplicationPackageImpl.class
| C:\DataDisk\Workspaces\Amf\product_java_jboss_NodeAgent\target\classes\org\epo\product\jboss\nodeagent\bindingmanager\impl\CloneImpl.class"'
| [ERROR] Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/metadata/spi/signature/Signature
| [ERROR] at org.jboss.aop.ClassicWeavingStrategy.translate(ClassicWeavingStrategy.java:95)
| [ERROR] at org.jboss.aop.AspectManager.translate(AspectManager.java:951)
| [ERROR] at org.jboss.aop.AspectManager.transform(AspectManager.java:894)
| [ERROR] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:347)
| [ERROR] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:236)
| [ERROR] at org.jboss.aop.standalone.Compiler.main(Compiler.java:92)
| [INFO] [aop-debug] org.jboss.aop.instrument.InstrumentorFactory Passed in instrumentor: null
| [INFO] [aop-debug] org.jboss.aop.instrument.InstrumentorFactory Defaulting instrumentor to: org.jboss.aop.instrument.GeneratedAdvisorInstrumentor
| [INFO] [aop-debug] org.jboss.aop.AdvisorFactory Passed in advisor: null
| [INFO] [aop-debug] org.jboss.aop.AdvisorFactory [debug] Defaulting advisor to: org.jboss.aop.ClassAdvisor
| [INFO] [aop-debug] org.jboss.aop.Deployment jboss.aop.class.path is NULL
| [INFO] [aop-debug] org.jboss.aop.Deployment jboss.aop.search.classpath: 'null' true
| [INFO] [aop-debug] org.jboss.aop.Deployment jboss.aop.path: src/test/resources/META-INF/binding-manager-aop.xml
| [INFO] [aop-debug] org.jboss.aop.Deployment jboss.aop.path[0]: src/test/resources/META-INF/binding-manager-aop.xml
| [INFO] [aop-debug] org.jboss.aop.Deployment deploying file:/C:/DataDisk/Workspaces/Amf/product_java_jboss_NodeAgent/src/test/resources/META-INF/binding-manager-aop.xml
| [INFO] [aop-debug] org.jboss.aop.AspectXmlLoader AspectXMLLoader using managerorg.jboss.aop.AspectManager@1a05308
| [INFO] ------------------------------------------------------------------------
| [INFO] BUILD SUCCESSFUL
| [INFO] ------------------------------------------------------------------------
And following is my pom section defining the plugin:
<plugin>
| <groupId>org.jboss.maven.plugins</groupId>
| <artifactId>maven-jbossaop-plugin</artifactId>
| <version>2.0.0.beta1</version>
| <executions>
| <execution>
| <phase>process-classes</phase>
| <!-- id>compile</id -->
| <configuration>
| <verbose>true</verbose>
| <aoppaths>
| <aoppath>src/test/resources/META-INF/binding-manager-aop.xml</aoppath>
| </aoppaths>
| <includes>
| <include>org/epo/product/jboss/nodeagent/bindingmanager/impl/ApplicationPackageImpl.class</include>
| <include>org/epo/product/jboss/nodeagent/bindingmanager/impl/CloneImpl.class</include>
| </includes>
| </configuration>
| <goals>
| <goal>compile</goal>
| </goals>
| </execution>
| </executions>
| </plugin>
Can you tell me what I am doing wrong here?
Thanks,
Marcel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104531#4104531
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104531
18 years, 8 months