You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Svetlin Zarev (JIRA)" <ji...@apache.org> on 2017/06/06 13:24:18 UTC

[jira] [Updated] (TOMEE-2053) ejb-jar.xml should take precedence over annotations

     [ https://issues.apache.org/jira/browse/TOMEE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Svetlin Zarev updated TOMEE-2053:
---------------------------------
    Description: 
*Test case description:*
* WAR application with EJB that declares datasource via @DataSourceDefinition annotation
* ejb-jar.xml inside /WEB-INF that overrides the attribute values.

*Expectation:*
The datasource is created with properties specified in the ejb-jar.xml

*What really happens:*
The datasource is created with the properties from the annotation

*Sample application & how to test:*
Attached sample.zip -  both sources and WAR. The sample application decaleres datasource with annotation with JDBC driver class that does not exists. The same application packages ejb-jar.xml that overwrites the faulty JDBC driver class with a correct one. 

*What happens: *
The sample app fails to deploy because of ClassNotFoundException, because the ejb-jar.xml is not taken into account.

*StackTrace:*
{code}
16:08:39.221 [localhost-startStop-1] ERROR OpenEJB.tomcat - Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve class no-such-class
        at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43)
        at org.apache.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86)
        at org.apache.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284)
        at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:181)
        at org.apache.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:592)
        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:275)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:2970)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2803)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2194)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:190)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1276)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1124)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:807)
Caused by: java.lang.ClassNotFoundException: no-such-class
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:204)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forNameFW(Class.java:288)
        at java.lang.Class.forName(Class.java:281)
        at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40)
        ... 32 common frames omitted
{code}

  was:
Test case description:
* WAR application with EJB that declares datasource via @DataSourceDefinition annotation
* ejb-jar.xml inside /WEB-INF that overrides the attribute values.

Expectation:
The datasource is created with properties specified in the ejb-jar.xml

What really happens:
The datasource is created with the properties from the annotation

Sample application & how to test:
Attached sample.zip -  both sources and WAR. The sample application decaleres datasource with annotation with JDBC driver class that does not exists. The same application packages ejb-jar.xml that overwrites the faulty JDBC driver class with a correct one. 

What happens: 
The sample app fails to deploy because of ClassNotFoundException, because the ejb-jar.xml is not taken into account.

StackTrace:
{code}
16:08:39.221 [localhost-startStop-1] ERROR OpenEJB.tomcat - Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve class no-such-class
        at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43)
        at org.apache.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86)
        at org.apache.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284)
        at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:181)
        at org.apache.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:592)
        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:275)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:2970)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2803)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2194)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:190)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1276)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1124)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:807)
Caused by: java.lang.ClassNotFoundException: no-such-class
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:204)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forNameFW(Class.java:288)
        at java.lang.Class.forName(Class.java:281)
        at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40)
        ... 32 common frames omitted
{code}


> ejb-jar.xml should take precedence over annotations
> ---------------------------------------------------
>
>                 Key: TOMEE-2053
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2053
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Svetlin Zarev
>         Attachments: sample.zip
>
>
> *Test case description:*
> * WAR application with EJB that declares datasource via @DataSourceDefinition annotation
> * ejb-jar.xml inside /WEB-INF that overrides the attribute values.
> *Expectation:*
> The datasource is created with properties specified in the ejb-jar.xml
> *What really happens:*
> The datasource is created with the properties from the annotation
> *Sample application & how to test:*
> Attached sample.zip -  both sources and WAR. The sample application decaleres datasource with annotation with JDBC driver class that does not exists. The same application packages ejb-jar.xml that overwrites the faulty JDBC driver class with a correct one. 
> *What happens: *
> The sample app fails to deploy because of ClassNotFoundException, because the ejb-jar.xml is not taken into account.
> *StackTrace:*
> {code}
> 16:08:39.221 [localhost-startStop-1] ERROR OpenEJB.tomcat - Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
> org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve class no-such-class
>         at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43)
>         at org.apache.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86)
>         at org.apache.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284)
>         at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:181)
>         at org.apache.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:592)
>         at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:275)
>         at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>         at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>         at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:2970)
>         at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2803)
>         at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
>         at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
>         at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2194)
>         at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:190)
>         at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
>         at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
>         at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1276)
>         at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1124)
>         at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
>         at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
>         at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
>         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
>         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
>         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
>         at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
>         at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:807)
> Caused by: java.lang.ClassNotFoundException: no-such-class
>         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
>         at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:204)
>         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forNameFW(Class.java:288)
>         at java.lang.Class.forName(Class.java:281)
>         at org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40)
>         ... 32 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)