tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Louis MONTEIRO <jeano...@gmail.com>
Subject Re: EJB 3.0 API
Date Fri, 19 Oct 2012 14:56:14 GMT
Yes, you're right, the inherited attr from ApplicationException is
available since 3.1.

JLouis

2012/10/19 Miguel Figueiredo <ollliegator@gmail.com>

> Hello,
>
> I have the following annotation according to EJB 3.0 spec:
>
> @Target(TYPE)
> @Retention(RUNTIME)
> public @interface ApplicationException {
>
>     /**
>      * Indicates whether the container should cause the transaction to
>      * rollback when the exception is thrown.
>      */
>     boolean rollback() default false;
>
> }
>
> In OpenEJB's AnnotationDeployer$ProcessAnnotatedBean we have the following
> method which invokes the inherited() method of the ApplicationException
> annotation:
>
>
> private void processApplicationExceptions(Class<?> clazz,
> AssemblyDescriptor assemblyDescriptor) {
>             /*
>              * @ApplicationException
>              */
>             for (Method method : clazz.getMethods()) {
>                 for (Class<?> exception : method.getExceptionTypes()) {
>                     ApplicationException annotation =
> exception.getAnnotation(ApplicationException.class);
>                     if (annotation == null) continue;
>                     if
> (assemblyDescriptor.getApplicationException(exception) != null) {
>
> mergeApplicationExceptionAnnotation(assemblyDescriptor, exception,
> annotation);
>                     } else {
>                         logger.debug("Found previously undetected
> application exception {0} listed on a method {1} with annotation {2}",
> method, exception, annotation);
>
> assemblyDescriptor.addApplicationException(exception,
> annotation.rollback(), *annotation.inherited()*);
>                     }
>                 }
>             }
>         }
>
> I tried using OpenEJB 3.1.4 in it worked with a basic test. Is version 3.x
> still being maintained?
>
> Here is the maven output with debug level:
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running OpenEjbIntegrationTest
> DEBUG - Using default 'tomee.deployement-exception-max-size=10'
> DEBUG - Using default 'openejb.nobanner=true'
> INFO - openejb.home = /home/miguel/workspace/...
> INFO - openejb.base = /home/miguel/workspace/...
> INFO - Created new singletonService
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@1ebd75b
> INFO - Succeeded in installing singleton service
> DEBUG - Using default
> 'openejb.assembler=org.apache.openejb.assembler.classic.Assembler'
> DEBUG - Instantiating assembler class
> org.apache.openejb.assembler.classic.Assembler
> DEBUG - Using default 'openejb.jndiname.failoncollision=true'
> DEBUG - Using default 'javax.ejb.embeddable.EJBContainer=false'
> DEBUG - Using default
> 'openejb.configurator=org.apache.openejb.config.ConfigurationFactory'
> DEBUG - Using default 'openejb.offline=false'
> DEBUG - Using default 'openejb.validation.skip=false'
> DEBUG - Using default 'openejb.deploymentId.format={ejbName}'
> DEBUG - Using default 'openejb.debuggable-vm-hackery=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> DEBUG - Using default 'openejb.vendor.config=ALL'  Possible values are:
> geronimo, glassfish, jboss, weblogic or NONE or ALL
> DEBUG - Using default 'openejb.extract.configuration=true'
> DEBUG - Using default
> 'openejb.provider.default=org.apache.openejb.embedded'
> INFO - Configuring Service(id=Default Security Service,
> type=SecurityService, provider-id=Default Security Service)
> INFO - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> DEBUG - Using default 'openejb.system.apps=false'
> DEBUG - Using default 'openejb.deployments.classpath=true'
> DEBUG - Using default 'openejb.exclude-include.order=include-exclude'
> DEBUG - Using default 'openejb.deployments.classpath.include=.*'
> DEBUG - Using default 'openejb.deployments.classpath.exclude='
> DEBUG - Using default
> 'openejb.deployments.classpath.require.descriptor=client'  Possible values
> are: ejb, client or NONE or ALL
> DEBUG - Using default
> 'openejb.deployments.classpath.filter.descriptors=false'
> DEBUG - Using default
> 'openejb.deployments.classpath.filter.systemapps=true'
> DEBUG - Loaded default.exclusions
> WARN - Inspecting classpath for applications: 72 urls.
> WARN - ADJUST THE EXCLUDE/INCLUDE!!!.  Current settings:
> openejb.deployments.classpath.exclude='',
> openejb.deployments.classpath.include='.*'
> DEBUG - URLs after filtering: 72
> DEBUG - Annotations path: jar:file:/home/miguel/.m2/...
> INFO - Searched 72 classpath urls in 2594 milliseconds.  Average 36
> milliseconds per url.
> DEBUG - Using default 'openejb.deployments.classpath.ear=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'antiJarLocking=false'
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/workspace/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Beginning load: /home/miguel/.m2/repository/...
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.tempclassloader.skip=none'  Possible values
> are: none, annotations, enums, all or NONE or ALL
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.modulename.useHash=false'
> DEBUG - Using default 'openejb.webservices.enabled=true'
> INFO - Configuring enterprise application: /home/miguel/workspace/...
> DEBUG - No ejb-jar.xml found assuming annotated beans present:
> /home/miguel/workspace/...
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Searching for annotated application exceptions (see OPENEJB-980)
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> WARN - Method 'lookup' is not available for 'javax.ejb.EJB'. The old API
> 'file:/home/miguel/.m2/repository/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar'
> was found on the classpath.
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Using default 'openejb.strict.interface.declaration=false'
> DEBUG - Using default 'openejb.callbacks.override=false'
> DEBUG - Found previously undetected application exception public void
> method() throws Exception listed on a method class Exception with
> annotation @javax.ejb.ApplicationException(rollback=true)
> FATAL - OpenEJB has encountered a fatal error and cannot be started: The
> Assembler encountered an unexpected error while attempting to build the
> container system.
> java.lang.NoSuchMethodError: javax.ejb.ApplicationException.inherited()Z
>     at
>
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processApplicationExceptions(AnnotationDeployer.java:2665)
>     at
>
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2176)
>     at
>
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1662)
>     at
>
> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:335)
>     at
>
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:363)
>     at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:850)
>     at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:728)
>     at
>
> org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:511)
>     at
>
> org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:361)
>     at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:340)
>     at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
>     at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:65)
>     at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
>     at org.apache.openejb.OpenEJB.init(OpenEJB.java:269)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>     at
>
> org.apache.openejb.core.LocalInitialContextFactory.init(LocalInitialContextFactory.java:69)
>     at
>
> org.apache.openejb.core.LocalInitialContextFactory.init(LocalInitialContextFactory.java:51)
>     at
>
> org.apache.openejb.core.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:40)
>     at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>     at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>     at javax.naming.InitialContext.init(InitialContext.java:223)
>     at javax.naming.InitialContext.<init>(InitialContext.java:175)
>     at
>
> pt.ptinovacao.ni.common.testframework.OpenEjbIntegrationTest.setup(OpenEjbIntegrationTest.java:18)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>     at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>     at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>     at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>     at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>     at
>
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>     at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>     at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>     at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>     at
>
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.449 sec
> <<< FAILURE!
>
> Results :
>
> Tests in error:
>   testName(pt.ptinovacao.ni.common.testframework.OpenEjbIntegrationTest)
>
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] There are test failures.
>
> Please refer to /home/miguel/workspace/... for the individual test results.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 9 seconds
> [INFO] Finished at: Fri Oct 19 14:54:42 WEST 2012
> [INFO] Final Memory: 37M/251M
> [INFO]
> ------------------------------------------------------------------------
>
> Best regards,
> Miguel
>
>
> On Fri, Oct 19, 2012 at 2:48 PM, Jean-Louis MONTEIRO <jeanouii@gmail.com
> >wrote:
>
> > Hello,
> >
> > 4.x implements EJB 3.1
> > 3.x implements EJB 3.0
> >
> > But EJB 3.1 does not break compatibility AFAIR, then, you should be able
> to
> > use 4.x.
> >
> > Could you share something (logs, etc)?
> >
> > JLouis
> >
> >
> > 2012/10/19 Miguel Figueiredo <ollliegator@gmail.com>
> >
> > > Hello,
> > >
> > > I wan't to use OpenEJB in a JUnit environment in order to test EJBs
> with
> > > 3.0 API. Which OpenEJB version should I use for this purpose?
> > >
> > > For example I tried to use version 4.5.0 but I got the following error:
> > >
> > > FATAL - OpenEJB has encountered a fatal error and cannot be started:
> The
> > > Assembler encountered an unexpected error while attempting to build the
> > > container system.
> > > java.lang.NoSuchMethodError:
> javax.ejb.ApplicationException.inherited()Z
> > >     at
> > >
> > >
> >
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processApplicationExceptions(AnnotationDeployer.java:2665)
> > >
> > > Best regards,
> > > Miguel
> > >
> > > --
> > > Miguel Figueiredo
> > > Software Developer
> > > http://jaragua.dyndns.org
> > >
> > > "I'm a pretty lazy person and am prepared to work quite hard in order
> to
> > > avoid work."
> > > -- Martin Fowler
> > >
> >
>
>
>
> --
> Miguel Figueiredo
> Software Developer
> http://jaragua.dyndns.org
>
> "I'm a pretty lazy person and am prepared to work quite hard in order to
> avoid work."
> -- Martin Fowler
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message