Ok I can set the JTA by using the JNDI name, but I hadn't found in log
what is the JNDI name for transactions: I have tried this
<extension qualifier="transaction">
<property name="manager">java:comp/env/TransactionManager</property>
</extension>
But I think this is not the right one.
El dt., 17 març, 2015 a les 13:14, Alex Soto (<[email protected]>) va
escriure:
> :S ok I am going to talk with Bartosz
>
>
> El dt., 17 març, 2015 a les 13:09, Romain Manni-Bucau (<
> [email protected]>) va escriure:
>
> A tx is automatically started by ape so then when you do it it is too late.
>> Le 17 mars 2015 13:02, "Alex Soto" <[email protected]> a écrit :
>>
>> > What's happening here? The exception is wrapped?
>> >
>> >
>> > El dt., 17 març, 2015 a les 12:47, Romain Manni-Bucau (<
>> > [email protected]>) va escriure:
>> >
>> > > nasty but
>> > > here: org.jboss.arquillian.persistence.transaction.
>> > > PersistenceExtensionConventionTransactionEnabler
>> > >
>> > >
>> > > Romain Manni-Bucau
>> > > @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
>> > > rmannibucau> |
>> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> > > <http://www.tomitribe.com>
>> > >
>> > > 2015-03-17 10:37 GMT+01:00 Alex Soto <[email protected]>:
>> > >
>> > > > if you update maven processor plugin to 2.2.4 it works :)
>> > > >
>> > > > El dt., 17 març, 2015 a les 10:29, Alex Soto (<[email protected]>)
>> va
>> > > > escriure:
>> > > >
>> > > > > Well in Eclipse it works hehehe :) I have not tried using maven
>> CLI,
>> > > but
>> > > > I
>> > > > > will take a look to see what's happening in this case.
>> > > > >
>> > > > > El dt., 17 març, 2015 a les 10:18, Romain Manni-Bucau (<
>> > > > > [email protected]>) va escriure:
>> > > > >
>> > > > > seems your project doesnt work:
>> > > > >>
>> > > > >> [INFO] --- maven-processor-plugin:2.1.0:process (process) @
>> > > > >> hibernate-example ---
>> > > > >> [INFO] Source directory:
>> > > > >> /home/rmannibucau/Bureau/jpaguide/sources/hibernate-example/
>> > > > >> target/generated-sources/apt
>> > > > >> added
>> > > > >> [INFO] javac option: -cp
>> > > > >> [INFO] javac option:
>> > > > >>
>> > /home/rmannibucau/.m2/repository/org/hibernate/hibernate-jpamodelgen/
>> > > > >>
>> > 4.3.8.Final/hibernate-jpamodelgen-4.3.8.Final.jar:/home/rmannibucau/.
>> > > > >> m2/repository/org/jboss/logging/jboss-logging/
>> > > > >> 3.1.3.GA/jboss-logging-3.1.3.GA.jar:/home/rmannibucau/.m2/re
>> > > > >> pository/org/jboss/logging/jboss-logging-annotations/1.2.0.
>> > > > >> Beta1/jboss-logging-annotations-1.2.0.Beta1.jar:/
>> > > home/rmannibucau/.m2/
>> > > > >> repository/org/sonatype/sisu/sisu-inject-bean/1.4.3.1/sisu-
>> > > inject-bean-
>> > > > >> 1.4.3.1.jar:/home/rmannibucau/.m2/repository/org/sonatype/
>> > > > >> sisu/sisu-guice/2.9.1/sisu-guice-2.9.1-noaop.jar:/home/
>> > > rmannibucau/.m2/
>> > > > >>
>> > > > repository/org/sonatype/aether/aether-util/1.8/aether-
>> > > util-1.8.jar:/home/
>> > > > >> rmannibucau/.m2/repository/org/codehaus/plexus/plexus-
>> > > interpolation/1.
>> > > > >> 14/plexus-interpolation-1.14.jar:/home/rmannibucau/.m2/repos
>> itory/
>> > > > >> org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-
>> > > > >> component-annotations-1.5.5.jar:/home/rmannibucau/.m2/
>> > > > >> repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/
>> > > > >> plexus-sec-dispatcher-1.3.jar:/home/rmannibucau/.m2/reposito
>> > > > >>
>> > ry/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar:/home/
>> > > > >> rmannibucau/.m2/repository/org/apache/maven/plugin-tools/
>> > > maven-plugin-
>> > > > >> annotations/3.1/maven-plugin-annotations-3.1.jar:/home/
>> > > rmannibucau/.m2/
>> > > > >> repository/org/codehaus/plexus/plexus-utils/3.0.1/plexus-
>> utils-3.0.
>> > > > >> 1.jar:/home/rmannibucau/Bureau/jpaguide/sources/
>> > > hibernate-example/src/
>> > > > >> main/resources:/home/rmannibucau/Bureau/jpaguide/sources/
>> > > > >> hibernate-example/target/classes:/home/rmannibucau/.m2/repos
>> itory/
>> > > > >> org/hibernate/hibernate-core/4.2.17.Final/hibernate-core-4.
>> > > 2.17.Final.
>> > > > >> jar:/home/rmannibucau/.m2/repository/antlr/antlr/2.7.7/antlr
>> -2.7.7.
>> > > > >> jar:/home/rmannibucau/.m2/repository/org/jboss/logging/jboss-
>> > > > >> logging/3.1.0.GA/jboss-logging-3.1.0.GA.jar:/home/rmannibuca
>> > > > >>
>> > > > u/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/
>> > > rmannibucau/.m2/
>> > > > >> repository/org/javassist/javassist/3.18.1-GA/javassist-
>> > > 3.18.1-GA.jar:/
>> > > > >> home/rmannibucau/.m2/repository/org/jboss/spec/
>> > > javax/transaction/jboss-
>> > > > >> transaction-api_1.1_spec/1.0.1.Final/jboss-transaction-api_1.1_
>> > > > >> spec-1.0.1.Final.jar:/home/rmannibucau/.m2/repository/org/
>> hibernate/
>> > > > >> javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernat
>> e-jpa-
>> > > > >> 2.0-api-1.0.1.Final.jar:/home/rmannibucau/.m2/repository/
>> > > org/hibernate/
>> > > > >> common/hibernate-commons-annotations/4.0.2.Final/hibernate-
>> commons-
>> > > > >> annotations-4.0.2.Final.jar:/home/rmannibucau/.m2/repository/
>> > > > >> org/hibernate/hibernate-entitymanager/4.2.17.Final/hibernate-
>> > > > >> entitymanager-4.2.17.Final.jar:/home/rmannibucau/.m2/repository/
>> > > > >> org/hibernate/hibernate-validator/4.3.2.Final/
>> > > hibernate-validator-4.3.2.
>> > > > >> Final.jar:/home/rmannibucau/.m2/repository/javax/validation
>> > > > >> /validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/
>> > > > >> home/rmannibucau/.m2/repository/org/apache/openejb/javaee-
>> > > > >> api/6.0-6/javaee-api-6.0-6.jar
>> > > > >> :
>> > > > >> [INFO] javac option: -proc:only
>> > > > >> [INFO] javac option: -processor
>> > > > >> [INFO] javac option: org.hibernate.jpamodelgen.JPAM
>> > > > >> etaModelEntityProcessor
>> > > > >> [INFO] javac option: -d
>> > > > >> [INFO] javac option:
>> > > > >> /home/rmannibucau/Bureau/jpaguide/sources/hibernate-example/
>> > > > >> target/classes
>> > > > >> [INFO] javac option: -s
>> > > > >> [INFO] javac option:
>> > > > >> /home/rmannibucau/Bureau/jpaguide/sources/hibernate-example/
>> > > > >> target/generated-sources/apt
>> > > > >> [INFO] diagnostic Note: Hibernate JPA 2 Static-Metamodel
>> Generator
>> > > > >> 4.3.8.Final
>> > > > >> An exception has occurred in the compiler (1.8.0_40). Please
>> file a
>> > > bug
>> > > > at
>> > > > >> the Java Developer Connection (
>> > http://java.sun.com/webapps/bugreport)
>> > > > >> after checking the Bug Parade for duplicates. Include your
>> program
>> > > and
>> > > > >> the
>> > > > >> following diagnostic in your report. Thank you.
>> > > > >> java.lang.IllegalStateException: endPosTable already set
>> > > > >> at
>> > > > >> com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(Dia
>> > > > >> gnosticSource.java:136)
>> > > > >> at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)
>> > > > >> at
>> > com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:667)
>> > > > >> at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompile
>> > > > >> r.java:950)
>> > > > >> at
>> > > > >> com.sun.tools.javac.processing.JavacProcessingEnvironment$
>> > > Round.<init>(
>> > > > >> JavacProcessingEnvironment.java:892)
>> > > > >> at
>> > > > >>
>> > com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(
>> > > > >> JavacProcessingEnvironment.java:921)
>> > > > >> at
>> > > > >> com.sun.tools.javac.processing.JavacProcessingEnvironment.
>> > > doProcessing(
>> > > > >> JavacProcessingEnvironment.java:1187)
>> > > > >> at
>> > > > >> com.sun.tools.javac.main.JavaCompiler.processAnnotations(Jav
>> > > > >> aCompiler.java:1170)
>> > > > >> at com.sun.tools.javac.main.JavaCompiler.compile(
>> > > JavaCompiler.java:856)
>> > > > >> at com.sun.tools.javac.main.Main.compile(Main.java:523)
>> > > > >> at com.sun.tools.javac.api.JavacTaskImpl.doCall(
>> > > JavacTaskImpl.java:129)
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >> Romain Manni-Bucau
>> > > > >> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> > > > >> <http://rmannibucau.wordpress.com> | Github <https://github.com/
>> > > > >> rmannibucau> |
>> > > > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> > > > >> <http://www.tomitribe.com>
>> > > > >>
>> > > > >> 2015-03-17 10:02 GMT+01:00 Alex Soto <[email protected]>:
>> > > > >>
>> > > > >> > No, you can see source code here:
>> > > > >> >
>> > > > >> > https://github.com/Scytl/jpaguide/blob/master/sources/hibern
>> > > > >>
>> > > > ate-example/src/test/java/com/scytl/hibernate/
>> > > MoviesServiceTest.java#L190
>> > > > >> >
>> > > > >> > El dt., 17 març, 2015 a les 9:55, Romain Manni-Bucau (<
>> > > > >> > [email protected]>)
>> > > > >> > va escriure:
>> > > > >> >
>> > > > >> > > so it is already started, why you have this issue, no
>> > > > @Transactional?
>> > > > >> > >
>> > > > >> > >
>> > > > >> > > Romain Manni-Bucau
>> > > > >> > > @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> > > > >> > > <http://rmannibucau.wordpress.com> | Github <
>> > https://github.com/
>> > > > >> > > rmannibucau> |
>> > > > >> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
>> Tomitriber
>> > > > >> > > <http://www.tomitribe.com>
>> > > > >> > >
>> > > > >> > > 2015-03-17 9:34 GMT+01:00 Alex Soto <[email protected]>:
>> > > > >> > >
>> > > > >> > > > This is the value hehehehe
>> > > > >> > > > org.apache.geronimo.transaction.manager.
>> > > TransactionImpl@6581bb9a
>> > > > >> > > >
>> > > > >> > > > El dt., 17 març, 2015 a les 9:28, Romain Manni-Bucau (<
>> > > > >> > > > [email protected]>)
>> > > > >> > > > va escriure:
>> > > > >> > > >
>> > > > >> > > > > And transaction is not null?
>> > > > >> > > > > Le 17 mars 2015 09:15, "Alex Soto" <[email protected]> a
>> > > écrit
>> > > > :
>> > > > >> > > > >
>> > > > >> > > > > > It returns a GeronimoTransactionManager instance. I
>> have
>> > > > >> modified
>> > > > >> > the
>> > > > >> > > > > code
>> > > > >> > > > > > as:
>> > > > >> > > > > >
>> > > > >> > > > > > @Test
>> > > > >> > > > > > @UsingDataSet("datasets/movies-with-version.yml")
>> > > > >> > > > > > public void test() throws Exception {
>> > > > >> > > > > > Transaction transaction =
>> > > > >> > > > > > OpenEJB.getTransactionManager().getTransaction();
>> > > > >> > > > > > userTransaction.begin();
>> > > > >> > > > > > Movie movie = moviesService.findMovieById(1L);
>> > > > >> > > > > >
>> > > > >> > > > > >
>> > > > >> > > > > >
>> > > > >> > > > > > El dl., 16 març, 2015 a les 18:41, Romain Manni-Bucau
>> (<
>> > > > >> > > > > > [email protected]>) va escriure:
>> > > > >> > > > > >
>> > > > >> > > > > > > Hi
>> > > > >> > > > > > >
>> > > > >> > > > > > > Isnt it already a tx associated to this method - you
>> can
>> > > > check
>> > > > >> > > > > > > OpenEJB.getTransactionManager().getTransaction()
>> value?
>> > > > >> > > > > > >
>> > > > >> > > > > > >
>> > > > >> > > > > > > Romain Manni-Bucau
>> > > > >> > > > > > > @rmannibucau <https://twitter.com/rmannibucau> |
>> Blog
>> > > > >> > > > > > > <http://rmannibucau.wordpress.com> | Github <
>> > > > >> https://github.com/
>> > > > >> > > > > > > rmannibucau> |
>> > > > >> > > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
>> > > > >> Tomitriber
>> > > > >> > > > > > > <http://www.tomitribe.com>
>> > > > >> > > > > > >
>> > > > >> > > > > > > 2015-03-16 15:29 GMT+01:00 Alex Soto <
>> [email protected]
>> > >:
>> > > > >> > > > > > >
>> > > > >> > > > > > > > Hi I am writing an Arquillian Persistence Test and
>> I
>> > am
>> > > > >> trying
>> > > > >> > to
>> > > > >> > > > > > > manually
>> > > > >> > > > > > > > begin and commit a transaction. Something like:
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > @Test
>> > > > >> > > > > > > > @UsingDataSet("datasets/movies-with-version.yml")
>> > > > >> > > > > > > > public void test() throws Exception {
>> > > > >> > > > > > > > userTransaction.begin();
>> > > > >> > > > > > > > Movie movie = moviesService.findMovieById(1L);
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > But when I run the test I get an exception:
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > javax.transaction.NotSupportedException: Nested
>> > > > >> Transactions
>> > > > >> > are
>> > > > >> > > > not
>> > > > >> > > > > > > > supported
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.apache.geronimo.transaction.manager.
>> > > > >> > > > > TransactionManagerImpl.begin(
>> > > > >> > > > > > > TransactionManagerImpl.java:157)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.apache.geronimo.transaction.manager.
>> > > > >> > > > > TransactionManagerImpl.begin(
>> > > > >> > > > > > > TransactionManagerImpl.java:152)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.apache.openejb.core.CoreUserTransaction.begin(
>> > > > >> > > > > > > CoreUserTransaction.java:55)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > >
>> > > > >> > > > com.scytl.hibernate.MoviesServiceTest.
>> shouldThrowAnOptimisti
>> > > > >> cLocking
>> > > > >> > > > > > > Exception(MoviesServiceTest.java:192)
>> > > > >> > > > > > > > at sun.reflect.NativeMethodAccessorImpl.
>> > > invoke0(Native
>> > > > >> > Method)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(
>> > > > >> > > > > > > NativeMethodAccessorImpl.java:62)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> > > > >> > > > > > > DelegatingMethodAccessorImpl.java:43)
>> > > > >> > > > > > > > at java.lang.reflect.Method.invok
>> e(Method.java:483)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.junit.runners.model.FrameworkMethod$1.
>> > > > >> runReflectiveCall(
>> > > > >> > > > > > > FrameworkMethod.java:50)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.junit.internal.runners.
>> > > model.ReflectiveCallable.run(
>> > > > >> > > > > > > ReflectiveCallable.java:12)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.junit.runners.model.FrameworkMethod.
>> > > invokeExplosively(
>> > > > >> > > > > > > FrameworkMethod.java:47)
>> > > > >> > > > > > > > at org.jboss.arquillian.junit.Arq
>> uillian$8$1.invoke(
>> > > > >> > > > > > > Arquillian.java:370)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > org.jboss.arquillian.container
>> .test.impl.execution.
>> > > > >> > > > > > > LocalTestExecuter.execute(LocalTestExecuter.java:60)
>> > > > >> > > > > > > > at sun.reflect.NativeMethodAccessorImpl.
>> > > invoke0(Native
>> > > > >> > Method)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(
>> > > > >> > > > > > > NativeMethodAccessorImpl.java:62)
>> > > > >> > > > > > > > at
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> > > > >> > > > > > > DelegatingMethodAccessorImpl.java:43)
>> > > > >> > > > > > > > at java.lang.reflect.Method.invok
>> e(Method.java:483)
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > Note that I am using Embedded adapter so the
>> openejb
>> > > > >> arquillian
>> > > > >> > > > > > > transaction
>> > > > >> > > > > > > > API is not used.
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > Is this normal? Can I make something to work with
>> > this?
>> > > > >> > > > > > > >
>> > > > >> > > > > > > > Thank you so much.
>> > > > >> > > > > > > >
>> > > > >> > > > > > >
>> > > > >> > > > > >
>> > > > >> > > > >
>> > > > >> > > >
>> > > > >> > >
>> > > > >> >
>> > > > >>
>> > > > >
>> > > >
>> > >
>> >
>>
>