You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/16 18:33:00 UTC
[jira] [Commented] (TOMEE-2053) ejb-jar.xml datsources support
[ https://issues.apache.org/jira/browse/TOMEE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052236#comment-16052236 ]
ASF GitHub Bot commented on TOMEE-2053:
---------------------------------------
GitHub user SvetlinZarev opened a pull request:
https://github.com/apache/tomee/pull/73
Fix TOMEE-2053: Override data source difinitions from ejb-jar.xml
CompManagedBean "aggregates" the annotations from the
other beans, but as it's artificially added to the ejb-jar by openejb, it
does not have an entry in the ejb-jar.xml. Hence when the
AnnotationDeployer processes the DataSourceDefinition annotation,
if neverfinds an existing data source definition in the ejb-jar.xml for it.
This inturn makes the annotation deployer to add a datas ource with
wrong configuration to the AppModule's ejb-jar.
ConvertDataSourceDefinitions deployer collects all data sources from
all JndiConsumers, so it collects the invalid definition as well and adds
it to the AppModule's resources. Because the invalid definition has the
same ID as the original, correct one, it overwrites is.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/SvetlinZarev/tomee ds_def
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tomee/pull/73.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #73
----
commit ccf0b0dbf3f8f11bbd5efe9d4c8d103c9bca1038
Author: Svetlin Zarev <sv...@sap.com>
Date: 2017-06-16T14:16:43Z
Test that datasource definitions from annotation are overriden by ejb-jar.xml
commit 6535f89ebc8446a7de06cb0674a28971f5b1b882
Author: Svetlin Zarev <sv...@sap.com>
Date: 2017-06-16T14:43:11Z
TOMEE-2053 Test datasource injection in servlet & ejb
commit a1116a965fe19703e893a089d81b97a78a6ec745
Author: Svetlin Zarev <sv...@abv.bg>
Date: 2017-06-16T17:42:58Z
Fix TOMEE-2053
CompManagedBean "aggregates" the annotations from the
other beans, but as it's artificially added to the ejb-jar by openejb, it
does not have an entry in the ejb-jar.xml. Hence when the
AnnotationDeployer processes the DataSourceDefinition annotation, if never
finds an exsiting datasource definition in the ejb-jar.xml for it. This in
turn makes the annotation deployer to add a datasource with wrong
configuration to the AppModule's ejb-jar. So far so good, but later, the
ConvertDataSourceDefinitions deployer collects all data sources from all
JndiConsumers, so it collects the invalid definition as well and adds it to
the AppModule's resources.
commit 26d2b9bf2c8b1e2e2d09bd627b0f35ad00aca21e
Author: Svetlin Zarev <sv...@abv.bg>
Date: 2017-06-16T18:00:29Z
Call the correct business method.
commit 5ed4ab403a8554738537565caef3afb6f292152b
Author: Svetlin Zarev <sv...@abv.bg>
Date: 2017-06-16T18:17:53Z
Add missing license header
commit fa891e801fc90d8e0795def9a25dbd0c652aad8c
Author: Svetlin Zarev <sv...@abv.bg>
Date: 2017-06-16T18:21:29Z
Add missing license header
commit 7e87055a949278a1227ce0551bb154977837d913
Author: Svetlin Zarev <sv...@abv.bg>
Date: 2017-06-16T18:26:10Z
Fix test name
----
> ejb-jar.xml datsources support
> ------------------------------
>
> Key: TOMEE-2053
> URL: https://issues.apache.org/jira/browse/TOMEE-2053
> Project: TomEE
> Issue Type: Bug
> Components: TomEE Core Server
> 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 of the bean's annotation.
> *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 and the values in the ejb-jar are ignored
> -----------------------------------------------------
> *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. If the ejb-jar.xml is taken into account, the app should deploy successfully. If the ejb-jar is not taken into account, the app will fail to deploy
> *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.4.14#64029)