2017-05-09 11:04 GMT+03:00 Romain Manni-Bucau <[email protected]>: > > Guess you can still use Lazy=true.
With Lazy flag I'm receiving the exception below. I tried also UseAppClassLoader = true the exception is the same as below. org.apache.openejb.OpenEJBException: Could not lookup <jta-data-source> 'openejb/Resource/eartest/jdbc/mydb' for unit 'mydb': Unable to resolve class org.hsqldb.jdbcDriver: Could not lookup <jta-data-source> 'openejb/Resource/eartest/jdbc/mydb' for unit 'mydb': Unable to resolve class org.hsqldb.jdbcDriver at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1042) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:718) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:714) at org.apache.tomee.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:2223) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:141) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1164) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1388) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1392) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1360) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBException: Could not lookup <jta-data-source> 'openejb/Resource/eartest/jdbc/mydb' for unit 'mydb': Unable to resolve class org.hsqldb.jdbcDriver: Could not lookup <jta-data-source> 'openejb/Resource/eartest/jdbc/mydb' for unit 'mydb': Unable to resolve class org.hsqldb.jdbcDriver at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:873) ... 10 more Caused by: org.apache.openejb.OpenEJBException: Could not lookup <jta-data-source> 'openejb/Resource/eartest/jdbc/mydb' for unit 'mydb': Unable to resolve class org.hsqldb.jdbcDriver at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:96) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:867) ... 10 more Caused by: org.apache.openejb.core.ivm.naming.LazyObjectReference$LazyNamingException: Unable to resolve class org.hsqldb.jdbcDriver at org.apache.openejb.core.ivm.naming.LazyObjectReference.getObject(LazyObjectReference.java:39) at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:176) at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:90) ... 11 more > > 2017-05-09 9:52 GMT+02:00 Violeta Georgieva <[email protected]>: > > > Hi, > > > > 2017-05-09 10:02 GMT+03:00 Romain Manni-Bucau <[email protected]>: > > > > > > Hi Violeta, > > > > > > yes for ears intent was to put the descriptor in META-INF and the driver > > in > > > ear/lib. That said you can add Lazy=true to support wars. > > > > I tried to put the driver in the EAR/lib and the resources.xml file in > > EAR/META-INF. > > Unfortunately the driver still cannot be found. (exception below, I > > intentionally removed the hsqldb from TomEE/lib) > > > > Debugging the code I saw that the context class loader was used [1]. The > > context class loader was the loader that contains TomEE/lib and not the > > EAR/lib. > > > > Shouldn't it use the EAR class loader? > > > > Regards, > > Violeta > > > > [1] > > https://github.com/apache/tomee/blob/master/container/ > > openejb-core/src/main/java/org/apache/openejb/assembler/ > > classic/Assembler.java#L2949 > > > > org.apache.xbean.propertyeditor.PropertyEditorException: Unable to > > resolve > > class org.hsqldb.jdbcDriver > > 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.checkHost( > > TomcatWebAppBuilder.java:2204) > > at > > org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent( > > GlobalListenerSupport.java:141) > > at > > org.apache.catalina.util.LifecycleBase.fireLifecycleEvent( > > LifecycleBase.java:94) > > at > > org.apache.catalina.core.ContainerBase.backgroundProcess( > > ContainerBase.java:1164) > > at > > org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor. > > processChildren(ContainerBase.java:1388) > > at > > org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor. > > processChildren(ContainerBase.java:1392) > > at > > org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor. > > run(ContainerBase.java:1360) > > at java.lang.Thread.run(Thread.java:745) > > Caused by: java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver > > at java.net.URLClassLoader.findClass(URLClassLoader.java:381) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:348) > > at > > org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java: > > 40) > > ... 24 more > > > > > > > > > > > > > Romain Manni-Bucau > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > > <https://blog-rmannibucau.rhcloud.com> | Old Blog > > > <http://rmannibucau.wordpress.com> | Github < > > https://github.com/rmannibucau> | > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory > > > <https://javaeefactory-rmannibucau.rhcloud.com> > > > > > > 2017-05-08 23:04 GMT+02:00 Violeta Georgieva <[email protected]>: > > > > > > > Hi, > > > > > > > > I have WAR archive that contains a driver, located in WEB-INF/lib and > > > > resources.xml, located in WEB-INF. The WAR file is packaged in an EAR > > file. > > > > When I deploy the EAR file I receive an exception that the driver > > cannot be > > > > located (ClassNotFoundException). > > > > Isn't it possible to provide a driver with my WAR archive? > > > > I'm using TomEE WebProfile 7.0.3. > > > > > > > > Thanks a lot, > > > > Violeta > > > > > > > > > > > > > > > > -- > > > > View this message in context: http://tomee-openejb.979440. > > > > n4.nabble.com/Driver-location-in-an-EAR-file-tp4681675.html > > > > Sent from the TomEE Users mailing list archive at Nabble.com. > > > > > >
