ValidationException due to META-INF/validation.xml's url capitalization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ValidationException due to META-INF/validation.xml's url capitalization

some user
Hi,

I'm using OpenEJB in embedded mode to test an EJB service (for the first time, so I'm not an expert OpenEJB user). The project containing the EJB class has also a META-INF/validation.xml.
The Problem: the deployment via EJBContainer.createEJBContainer() fails with a "javax.validation.ValidationException: More than one META-INF/validation.xml is found in the classpath", thrown by the validation framework.

My setup:
OpenEJB 7.0.4-SNAPSHOT, used inside a JUnit test case
IDE: Eclipse 4.6 Neon
OS: Windows 7
Bean Validation implementation: Apache bval-jsr 1.1.2
Dependency management with Maven
(there is no META-INF/ejb-jar.xml in the project, if that's of any importance)

In more detail: the bval-jsr-ValidationParser complains about two different META-INF/validation.xml files on the classpath (which is forbidden by spec of jsr 303). The reason is:
the project containing the EJB class is turned into an EjbModule by OpenEJB. Inside the EjbModule, the META-INF/validation.xml is known by the url

file:/c:/users/someuser/git/someproject/someproject-ejb/target/classes/META-INF/validation.xml.

The project also contains the test code, which OpenEJB deploys as a separate module / application. Inside that module, the same resource is known by the url

file:/C:/Users/someuser/git/someproject3/someproject3-ejb/target/classes/META-INF/validation.xml.

Due to the different capitalization, the URL.equals() fails, with both URLs referencing the same resource, which leads to the ValidationException during deployment.

I found out that on windows os, the org.apache.openejb.config.DeploymentsResolver.ClasspathSearcher.loadUrls() method converts URLs to lowercase when creating the EjbModule; I guess, on a host machine with a different os, my problem wouldn't appear.

My questions:
1. Just curious: what's the reason for lowercasing all URLs in EjbModules on windows systems?
2. Am I doing something fundamentally wrong within my test setup? I'm using OpenEJB in embedded mode directly (not via arquillian) from inside a JUnit test case, and want to use Bean Validation. A combination that shouldn't be too exotic. After some google research, I'm quite puzzled that nobody seems to have - at least not exactly - the same problem.

Any advice would be appreciated.

Here my test code:

public class SomeTestCase {

    protected EJBContainer ejbContainer;

    @Before
    public void setUp() {
        final Properties p = new Properties();
        p.put("someproject_junit", "new://Resource?type=DataSource");
        p.put("someproject_junit.JdbcDriver", "org.hsqldb.jdbcDriver");
        p.put("someproject_junit.JdbcUrl", "jdbc:hsqldb:mem:someproject_junit");
        p.put("openjpa.jdbc.DBDictionary", "hsql");
        p.put("openejb.jpa.deploy-time-enhancement", "true");
        p.put("openejb.jar.enhancement.include", "/**");
        try {
            // Some test code to find out about the validation.xml url
            Enumeration<URL> ejbJars;
            ejbJars = this.getClass().getClassLoader().getResources("META-INF/validation.xml");
            while (ejbJars.hasMoreElements()) {
                URL url = ejbJars.nextElement();
                System.out.println("app = " + url + ", filename=" + url.getFile());

            }
        } catch (IOException e) {
            fail(e.getMessage());
        }
        ejbContainer = EJBContainer.createEJBContainer(p);
        try {
            ejbContainer.getContext().bind("inject", this);
        } catch (NamingException e) {
            fail(e.getMessage());
        }

    }

    @After
    public void tearDown() {
        ejbContainer.close();
    }

    @Test
    public void testSomething() {
        fail("not yet implemented");
    }
}

Here the log output:
app = file:/C:/Users/someuser/git/someproject3/someproject3-ejb/target/classes/META-INF/validation.xml, filename=/C:/Users/someuser/git/someproject3/someproject3-ejb/target/classes/META-INF/validation.xml
INFORMATION - ********************************************************************************
INFORMATION - OpenEJB http://tomee.apache.org/
INFORMATION - Startup: Thu Jun 22 08:16:16 CEST 2017
INFORMATION - Copyright 1999-2017 (C) Apache OpenEJB Project, All Rights Reserved.
INFORMATION - Version: 7.0.4-SNAPSHOT
INFORMATION - Build date: 20170620
INFORMATION - Build time: 04:07
INFORMATION - ********************************************************************************
INFORMATION - openejb.home = C:\Users\someuser\git\someproject3\someproject3-ejb
INFORMATION - openejb.base = C:\Users\someuser\git\someproject3\someproject3-ejb
INFORMATION - Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@78047b92
INFORMATION - Succeeded in installing singleton service
INFORMATION - Using 'javax.ejb.embeddable.EJBContainer=true'
INFORMATION - TomEE configuration file is 'C:\Users\someuser\git\someproject3\someproject3-ejb\etc\openejb.xml'
INFORMATION - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
INFORMATION - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
INFORMATION - Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
INFORMATION - Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
INFORMATION - Configuring Service(id=someproject_junit, type=Resource, provider-id=Default JDBC Database)
INFORMATION - Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
INFORMATION - Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
INFORMATION - Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
INFORMATION - Using 'openejb.jpa.deploy-time-enhancement=true'
INFORMATION - Creating TransactionManager(id=Default Transaction Manager)
INFORMATION - Creating SecurityService(id=Default Security Service)
INFORMATION - Creating Resource(id=My DataSource)
INFORMATION - Creating Resource(id=My Unmanaged DataSource)
INFORMATION - Creating Resource(id=someproject_junit)
INFORMATION - Creating Container(id=My Singleton Container)
INFORMATION - Creating Container(id=My Stateful Container)
INFORMATION - Using directory C:\Users\someuser\AppData\Local\Temp for stateful session passivation
INFORMATION - Creating Container(id=My Stateless Container)
INFORMATION - Found EjbModule in classpath: c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-core-api\1.7.1\deltaspike-core-api-1.7.1.jar
INFORMATION - Found EjbModule in classpath: c:\users\someuser\.m2\repository\org\apache\deltaspike\cdictrl\deltaspike-cdictrl-openejb\1.7.1\deltaspike-cdictrl-openejb-1.7.1.jar
INFORMATION - Found EjbModule in classpath: c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-core-impl\1.7.1\deltaspike-core-impl-1.7.1.jar
INFORMATION - Found EjbModule in classpath: c:\users\someuser\git\someproject3\someproject3-ejb\target\classes
INFORMATION - Found EjbModule in classpath: c:\users\someuser\.m2\repository\com\somecompany\someframework\someframework-commons\6.1.0-snapshot\someframework-commons-6.1.0-snapshot.jar
INFORMATION - Beginning load: c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-core-api\1.7.1\deltaspike-core-api-1.7.1.jar
INFORMATION - Enhancing url(s): [file:/c:/users/someuser/.m2/repository/org/apache/deltaspike/core/deltaspike-core-api/1.7.1/deltaspike-core-api-1.7.1.jar]
INFORMATION - Beginning load: c:\users\someuser\.m2\repository\org\apache\deltaspike\cdictrl\deltaspike-cdictrl-openejb\1.7.1\deltaspike-cdictrl-openejb-1.7.1.jar
INFORMATION - Enhancing url(s): [file:/c:/users/someuser/.m2/repository/org/apache/deltaspike/cdictrl/deltaspike-cdictrl-openejb/1.7.1/deltaspike-cdictrl-openejb-1.7.1.jar]
INFORMATION - Beginning load: c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-core-impl\1.7.1\deltaspike-core-impl-1.7.1.jar
INFORMATION - Enhancing url(s): [file:/c:/users/someuser/.m2/repository/org/apache/deltaspike/core/deltaspike-core-impl/1.7.1/deltaspike-core-impl-1.7.1.jar]
INFORMATION - Beginning load: c:\users\someuser\git\someproject3\someproject3-ejb\target\classes
INFORMATION - Enhancing url(s): [file:/c:/users/someuser/git/someproject3/someproject3-ejb/target/classes/]
INFORMATION - Beginning load: c:\users\someuser\.m2\repository\com\somecompany\someframework\someframework-commons\6.1.0-snapshot\someframework-commons-6.1.0-snapshot.jar
INFORMATION - Enhancing url(s): [file:/c:/users/someuser/.m2/repository/de/nordlb/someframework/someframework-commons/6.1.0-snapshot/someframework-commons-6.1.0-snapshot.jar]
INFORMATION - Configuring enterprise application: C:\Users\someuser\git\someproject3\someproject3-ejb
java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.openejb.util.Classes.forName(Classes.java:64)
        at org.apache.openejb.config.rules.ValidationBase.loadClass(ValidationBase.java:151)
        at org.apache.openejb.config.rules.CheckClasses.check_hasInterface(CheckClasses.java:195)
        at org.apache.openejb.config.rules.CheckClasses.validate(CheckClasses.java:118)
        at org.apache.openejb.config.rules.ValidationBase.validate(ValidationBase.java:50)
        at org.apache.openejb.config.AppValidator.validate(AppValidator.java:102)
        at org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:38)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:322)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
        at de.nordlb.someproject.biz.bc.SomeTestCase.setUp(SomeTestCase.java:39)
        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.invoke(Method.java:498)
        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.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: javax.validation.ValidationException: More than one META-INF/validation.xml is found in the classpath
        at org.apache.bval.jsr.xml.ValidationParser.getInputStream(ValidationParser.java:204)
        at org.apache.bval.jsr.xml.ValidationParser.__privileged_parseXmlConfig(ValidationParser.java:167)
        at org.apache.bval.jsr.xml.ValidationParser.parseXmlConfig(ValidationParser.java)
        at org.apache.bval.jsr.xml.ValidationParser.processValidationConfig(ValidationParser.java:108)
        at org.apache.bval.jsr.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:357)
        at org.apache.bval.jsr.ConfigurationImpl.createBootstrapConfiguration(ConfigurationImpl.java:349)
        at org.apache.bval.jsr.ConfigurationImpl.prepare(ConfigurationImpl.java:340)
        at org.apache.bval.jsr.ConfigurationImpl.__privileged_doBuildValidatorFactory(ConfigurationImpl.java:329)
        at org.apache.bval.jsr.ConfigurationImpl.doBuildValidatorFactory(ConfigurationImpl.java)
        at org.apache.bval.jsr.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:324)
        at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:41)
        at de.nordlb.someproject.biz.bc.AbstractsomeprojectEntityService.<clinit>(AbstractsomeprojectEntityService.java:29)
        ... 38 more
INFORMATION - Auto-deploying ejb AssetShipSearchService: EjbDeployment(deployment-id=AssetShipSearchService)
INFORMATION - Auto-deploying ejb OrderShipService: EjbDeployment(deployment-id=OrderShipService)
INFORMATION - Auto-deploying ejb EngineTypeService: EjbDeployment(deployment-id=EngineTypeService)
INFORMATION - Auto-deploying ejb SelectableService: EjbDeployment(deployment-id=SelectableService)
INFORMATION - Auto-deploying ejb LandService: EjbDeployment(deployment-id=LandService)
INFORMATION - Auto-deploying ejb UserService: EjbDeployment(deployment-id=UserService)
INFORMATION - Auto-deploying ejb StammdatenDefaultService: EjbDeployment(deployment-id=StammdatenDefaultService)
INFORMATION - Auto-deploying ejb OrderShipSearchService: EjbDeployment(deployment-id=OrderShipSearchService)
INFORMATION - Auto-deploying ejb ContractorService: EjbDeployment(deployment-id=ContractorService)
INFORMATION - Auto-deploying ejb AssetShipService: EjbDeployment(deployment-id=AssetShipService)
INFORMATION - Auto-deploying ejb MathHelper: EjbDeployment(deployment-id=MathHelper)
INFORMATION - Auto-deploying ejb someprojectConfiguration: EjbDeployment(deployment-id=someprojectConfiguration)
INFORMATION - Auto-deploying ejb InstituteEntityManager: EjbDeployment(deployment-id=InstituteEntityManager)
INFORMATION - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
INFORMATION - Auto-creating a container for bean deltaspike-core-api-1.7.1.Comp536671860: Container(type=MANAGED, id=Default Managed Container)
INFORMATION - Creating Container(id=Default Managed Container)
INFORMATION - Using directory C:\Users\someuser\AppData\Local\Temp for stateful session passivation
INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa' in bean AssetShipSearchService to Resource(id=My DataSource)
INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa' in bean OrderShipSearchService to Resource(id=My DataSource)
INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa' in bean someproject3-ejb.Comp719146276 to Resource(id=My DataSource)
INFORMATION - Configuring PersistenceUnit(name=someprojectPU)
INFORMATION - Adjusting PersistenceUnit someprojectPU <jta-data-source> to Resource ID 'My DataSource' from 'jdbc/dezentral.xa'
INFORMATION - Adjusting PersistenceUnit someprojectPU <non-jta-data-source> to Resource ID 'My Unmanaged DataSource' from 'null'
SCHWERWIEGEND - ERROR ... null: Cannot validate jar: null
SCHWERWIEGEND - Invalid AppModule(name=, path=)
INFORMATION - Set the 'openejb.validation.output.level' system property to VERBOSE for increased validation details.
WARNUNG - configureApplication.loadFailed
INFORMATION - Closing DataSource: My DataSource
INFORMATION - Closing DataSource: My Unmanaged DataSource
INFORMATION - Closing DataSource: someproject_junit

Many Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ValidationException due to META-INF/validation.xml's url capitalization

Romain Manni-Bucau
Hi


2017-06-22 11:02 GMT+02:00 some user <[hidden email]>:

> Hi,
>
> I'm using OpenEJB in embedded mode to test an EJB service (for the first
> time, so I'm not an expert OpenEJB user). The project containing the EJB
> class has also a META-INF/validation.xml.
> The Problem: the deployment via EJBContainer.createEJBContainer() fails
> with
> a "javax.validation.ValidationException: More than one
> META-INF/validation.xml is found in the classpath", thrown by the
> validation
> framework.
>
> My setup:
> OpenEJB 7.0.4-SNAPSHOT, used inside a JUnit test case
> IDE: Eclipse 4.6 Neon
> OS: Windows 7
> Bean Validation implementation: Apache bval-jsr 1.1.2
> Dependency management with Maven
> (there is no META-INF/ejb-jar.xml in the project, if that's of any
> importance)
>
> In more detail: the bval-jsr-ValidationParser complains about two different
> META-INF/validation.xml files on the classpath (which is forbidden by spec
> of jsr 303). The reason is:
> the project containing the EJB class is turned into an EjbModule by
> OpenEJB.
> Inside the EjbModule, the META-INF/validation.xml is known by the url
>
> file:/c:/users/someuser/git/someproject/someproject-ejb/
> target/classes/META-INF/validation.xml.
>
> The project also contains the test code, which OpenEJB deploys as a
> separate
> module / application. Inside that module, the same resource is known by the
> url
>
> file:/C:/Users/someuser/git/someproject3/someproject3-ejb/
> target/classes/META-INF/validation.xml.
>
>
is it intended it is not the same URLs? (someproject3 vs someproject)


> Due to the different capitalization, the URL.equals() fails, with both URLs
> referencing the same resource, which leads to the ValidationException
> during
> deployment.
>
> I found out that on windows os, the
> org.apache.openejb.config.DeploymentsResolver.ClasspathSearcher.loadUrls()
> method converts URLs to lowercase when creating the EjbModule; I guess, on
> a
> host machine with a different os, my problem wouldn't appear.
>
> My questions:
> 1. Just curious: what's the reason for lowercasing all URLs in EjbModules
> on
> windows systems?
>

windows filesystem is generally not case sensitive so goal was to avoid
duplicates (like c:\FOO vs c:\foo)


> 2. Am I doing something fundamentally wrong within my test setup? I'm using
> OpenEJB in embedded mode directly (not via arquillian) from inside a JUnit
> test case, and want to use Bean Validation. A combination that shouldn't be
> too exotic. After some google research, I'm quite puzzled that nobody seems
> to have - at least not exactly - the same problem.
>
>
Interesting think is openejb does it "right" but bval doesnt ignore the
case (
https://github.com/apache/bval/blob/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java#L203)
and therefore doesnt recognize both being the same.

First thing I'd do is to check why the case is different, even if openejb
tries to absorb that it is generally an issue when launching the command
line/created the classpath.

If still an issue you can probably use as you mentionned arquillian or
ApplicationComposer but EJBContainer normally works when the JVM is not
corrupted (if you use eclipse, give it a try outside eclipse too).


> Any advice would be appreciated.
>
> Here my test code:
>
> public class SomeTestCase {
>
>     protected EJBContainer ejbContainer;
>
>     @Before
>     public void setUp() {
>         final Properties p = new Properties();
>         p.put("someproject_junit", "new://Resource?type=DataSource");
>         p.put("someproject_junit.JdbcDriver", "org.hsqldb.jdbcDriver");
>         p.put("someproject_junit.JdbcUrl",
> "jdbc:hsqldb:mem:someproject_junit");
>         p.put("openjpa.jdbc.DBDictionary", "hsql");
>         p.put("openejb.jpa.deploy-time-enhancement", "true");
>         p.put("openejb.jar.enhancement.include", "/**");
>         try {
>             // Some test code to find out about the validation.xml url
>             Enumeration<URL> ejbJars;
>             ejbJars =
> this.getClass().getClassLoader().getResources("META-INF/validation.xml");
>             while (ejbJars.hasMoreElements()) {
>                 URL url = ejbJars.nextElement();
>                 System.out.println("app = " + url + ", filename=" +
> url.getFile());
>
>             }
>         } catch (IOException e) {
>             fail(e.getMessage());
>         }
>         ejbContainer = EJBContainer.createEJBContainer(p);
>         try {
>             ejbContainer.getContext().bind("inject", this);
>         } catch (NamingException e) {
>             fail(e.getMessage());
>         }
>
>     }
>
>     @After
>     public void tearDown() {
>         ejbContainer.close();
>     }
>
>     @Test
>     public void testSomething() {
>         fail("not yet implemented");
>     }
> }
>
> Here the log output:
> app =
> filename=/C:/Users/someuser/git/someproject3/someproject3-ejb/
> target/classes/META-INF/validation.xml,
> filename=/C:/Users/someuser/git/someproject3/someproject3-
> ejb/target/classes/META-INF/validation.xml
> INFORMATION -
> ************************************************************
> ********************
> INFORMATION - OpenEJB http://tomee.apache.org/
> INFORMATION - Startup: Thu Jun 22 08:16:16 CEST 2017
> INFORMATION - Copyright 1999-2017 (C) Apache OpenEJB Project, All Rights
> Reserved.
> INFORMATION - Version: 7.0.4-SNAPSHOT
> INFORMATION - Build date: 20170620
> INFORMATION - Build time: 04:07
> INFORMATION -
> ************************************************************
> ********************
> INFORMATION - openejb.home =
> C:\Users\someuser\git\someproject3\someproject3-ejb
> INFORMATION - openejb.base =
> C:\Users\someuser\git\someproject3\someproject3-ejb
> INFORMATION - Created new singletonService
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@78047b92
> INFORMATION - Succeeded in installing singleton service
> INFORMATION - Using 'javax.ejb.embeddable.EJBContainer=true'
> INFORMATION - TomEE configuration file is
> 'C:\Users\someuser\git\someproject3\someproject3-ejb\etc\openejb.xml'
> INFORMATION - Configuring Service(id=Default Security Service,
> type=SecurityService, provider-id=Default Security Service)
> INFORMATION - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> INFORMATION - Configuring Service(id=My DataSource, type=Resource,
> provider-id=Default JDBC Database)
> INFORMATION - Configuring Service(id=My Unmanaged DataSource,
> type=Resource,
> provider-id=Default JDBC Database)
> INFORMATION - Configuring Service(id=someproject_junit, type=Resource,
> provider-id=Default JDBC Database)
> INFORMATION - Configuring Service(id=My Singleton Container,
> type=Container,
> provider-id=Default Singleton Container)
> INFORMATION - Configuring Service(id=My Stateful Container, type=Container,
> provider-id=Default Stateful Container)
> INFORMATION - Configuring Service(id=My Stateless Container,
> type=Container,
> provider-id=Default Stateless Container)
> INFORMATION - Using 'openejb.jpa.deploy-time-enhancement=true'
> INFORMATION - Creating TransactionManager(id=Default Transaction Manager)
> INFORMATION - Creating SecurityService(id=Default Security Service)
> INFORMATION - Creating Resource(id=My DataSource)
> INFORMATION - Creating Resource(id=My Unmanaged DataSource)
> INFORMATION - Creating Resource(id=someproject_junit)
> INFORMATION - Creating Container(id=My Singleton Container)
> INFORMATION - Creating Container(id=My Stateful Container)
> INFORMATION - Using directory C:\Users\someuser\AppData\Local\Temp for
> stateful session passivation
> INFORMATION - Creating Container(id=My Stateless Container)
> INFORMATION - Found EjbModule in classpath:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-
> core-api\1.7.1\deltaspike-core-api-1.7.1.jar
> INFORMATION - Found EjbModule in classpath:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\cdictrl\deltaspike-
> cdictrl-openejb\1.7.1\deltaspike-cdictrl-openejb-1.7.1.jar
> INFORMATION - Found EjbModule in classpath:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-
> core-impl\1.7.1\deltaspike-core-impl-1.7.1.jar
> INFORMATION - Found EjbModule in classpath:
> c:\users\someuser\git\someproject3\someproject3-ejb\target\classes
> INFORMATION - Found EjbModule in classpath:
> c:\users\someuser\.m2\repository\com\somecompany\
> someframework\someframework-commons\6.1.0-snapshot\
> someframework-commons-6.1.0-snapshot.jar
> INFORMATION - Beginning load:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-
> core-api\1.7.1\deltaspike-core-api-1.7.1.jar
> INFORMATION - Enhancing url(s):
> [file:/c:/users/someuser/.m2/repository/org/apache/
> deltaspike/core/deltaspike-core-api/1.7.1/deltaspike-core-api-1.7.1.jar]
> INFORMATION - Beginning load:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\cdictrl\deltaspike-
> cdictrl-openejb\1.7.1\deltaspike-cdictrl-openejb-1.7.1.jar
> INFORMATION - Enhancing url(s):
> [file:/c:/users/someuser/.m2/repository/org/apache/
> deltaspike/cdictrl/deltaspike-cdictrl-openejb/1.7.1/
> deltaspike-cdictrl-openejb-1.7.1.jar]
> INFORMATION - Beginning load:
> c:\users\someuser\.m2\repository\org\apache\deltaspike\core\deltaspike-
> core-impl\1.7.1\deltaspike-core-impl-1.7.1.jar
> INFORMATION - Enhancing url(s):
> [file:/c:/users/someuser/.m2/repository/org/apache/
> deltaspike/core/deltaspike-core-impl/1.7.1/deltaspike-core-impl-1.7.1.jar]
> INFORMATION - Beginning load:
> c:\users\someuser\git\someproject3\someproject3-ejb\target\classes
> INFORMATION - Enhancing url(s):
> [file:/c:/users/someuser/git/someproject3/someproject3-ejb/
> target/classes/]
> INFORMATION - Beginning load:
> c:\users\someuser\.m2\repository\com\somecompany\
> someframework\someframework-commons\6.1.0-snapshot\
> someframework-commons-6.1.0-snapshot.jar
> INFORMATION - Enhancing url(s):
> [file:/c:/users/someuser/.m2/repository/de/nordlb/
> someframework/someframework-commons/6.1.0-snapshot/
> someframework-commons-6.1.0-snapshot.jar]
> INFORMATION - Configuring enterprise application:
> C:\Users\someuser\git\someproject3\someproject3-ejb
> java.lang.ExceptionInInitializerError
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:348)
>         at org.apache.openejb.util.Classes.forName(Classes.java:64)
>         at
> org.apache.openejb.config.rules.ValidationBase.
> loadClass(ValidationBase.java:151)
>         at
> org.apache.openejb.config.rules.CheckClasses.check_
> hasInterface(CheckClasses.java:195)
>         at
> org.apache.openejb.config.rules.CheckClasses.validate(
> CheckClasses.java:118)
>         at
> org.apache.openejb.config.rules.ValidationBase.validate(
> ValidationBase.java:50)
>         at org.apache.openejb.config.AppValidator.validate(
> AppValidator.java:102)
>         at
> org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:38)
>         at
> org.apache.openejb.config.ConfigurationFactory$Chain.
> deploy(ConfigurationFactory.java:420)
>         at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(
> ConfigurationFactory.java:1037)
>         at
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(
> OpenEjbContainer.java:322)
>         at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>         at de.nordlb.someproject.biz.bc.SomeTestCase.setUp(
> SomeTestCase.java:39)
>         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.invoke(Method.java:498)
>         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.junit.internal.runners.statements.RunBefores.
> evaluate(RunBefores.java:24)
>         at
> org.junit.internal.runners.statements.RunAfters.evaluate(
> RunAfters.java:27)
>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>         at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(
> BlockJUnit4ClassRunner.java:78)
>         at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(
> BlockJUnit4ClassRunner.java:57)
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>         at org.junit.runners.ParentRunner.runChildren(
> ParentRunner.java:288)
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>         at org.junit.runners.ParentRunner$2.evaluate(
> ParentRunner.java:268)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>         at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
> JUnit4TestReference.java:86)
>         at
> org.eclipse.jdt.internal.junit.runner.TestExecution.
> run(TestExecution.java:38)
>         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> runTests(RemoteTestRunner.java:459)
>         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> runTests(RemoteTestRunner.java:678)
>         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> run(RemoteTestRunner.java:382)
>         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.
> main(RemoteTestRunner.java:192)
> Caused by: javax.validation.ValidationException: More than one
> META-INF/validation.xml is found in the classpath
>         at
> org.apache.bval.jsr.xml.ValidationParser.getInputStream(
> ValidationParser.java:204)
>         at
> org.apache.bval.jsr.xml.ValidationParser.__privileged_parseXmlConfig(
> ValidationParser.java:167)
>         at
> org.apache.bval.jsr.xml.ValidationParser.parseXmlConfig(
> ValidationParser.java)
>         at
> org.apache.bval.jsr.xml.ValidationParser.processValidationConfig(
> ValidationParser.java:108)
>         at
> org.apache.bval.jsr.ConfigurationImpl.parseValidationXml(
> ConfigurationImpl.java:357)
>         at
> org.apache.bval.jsr.ConfigurationImpl.createBootstrapConfiguration(
> ConfigurationImpl.java:349)
>         at
> org.apache.bval.jsr.ConfigurationImpl.prepare(ConfigurationImpl.java:340)
>         at
> org.apache.bval.jsr.ConfigurationImpl.__privileged_
> doBuildValidatorFactory(ConfigurationImpl.java:329)
>         at
> org.apache.bval.jsr.ConfigurationImpl.doBuildValidatorFactory(
> ConfigurationImpl.java)
>         at
> org.apache.bval.jsr.ConfigurationImpl.buildValidatorFactory(
> ConfigurationImpl.java:324)
>         at
> javax.validation.Validation.buildDefaultValidatorFactory(
> Validation.java:41)
>         at
> de.nordlb.someproject.biz.bc.AbstractsomeprojectEntityService.<clinit>(
> AbstractsomeprojectEntityService.java:29)
>         ... 38 more
> INFORMATION - Auto-deploying ejb AssetShipSearchService:
> EjbDeployment(deployment-id=AssetShipSearchService)
> INFORMATION - Auto-deploying ejb OrderShipService:
> EjbDeployment(deployment-id=OrderShipService)
> INFORMATION - Auto-deploying ejb EngineTypeService:
> EjbDeployment(deployment-id=EngineTypeService)
> INFORMATION - Auto-deploying ejb SelectableService:
> EjbDeployment(deployment-id=SelectableService)
> INFORMATION - Auto-deploying ejb LandService:
> EjbDeployment(deployment-id=LandService)
> INFORMATION - Auto-deploying ejb UserService:
> EjbDeployment(deployment-id=UserService)
> INFORMATION - Auto-deploying ejb StammdatenDefaultService:
> EjbDeployment(deployment-id=StammdatenDefaultService)
> INFORMATION - Auto-deploying ejb OrderShipSearchService:
> EjbDeployment(deployment-id=OrderShipSearchService)
> INFORMATION - Auto-deploying ejb ContractorService:
> EjbDeployment(deployment-id=ContractorService)
> INFORMATION - Auto-deploying ejb AssetShipService:
> EjbDeployment(deployment-id=AssetShipService)
> INFORMATION - Auto-deploying ejb MathHelper:
> EjbDeployment(deployment-id=MathHelper)
> INFORMATION - Auto-deploying ejb someprojectConfiguration:
> EjbDeployment(deployment-id=someprojectConfiguration)
> INFORMATION - Auto-deploying ejb InstituteEntityManager:
> EjbDeployment(deployment-id=InstituteEntityManager)
> INFORMATION - Configuring Service(id=Default Managed Container,
> type=Container, provider-id=Default Managed Container)
> INFORMATION - Auto-creating a container for bean
> deltaspike-core-api-1.7.1.Comp536671860: Container(type=MANAGED,
> id=Default
> Managed Container)
> INFORMATION - Creating Container(id=Default Managed Container)
> INFORMATION - Using directory C:\Users\someuser\AppData\Local\Temp for
> stateful session passivation
> INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa'
> in
> bean AssetShipSearchService to Resource(id=My DataSource)
> INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa'
> in
> bean OrderShipSearchService to Resource(id=My DataSource)
> INFORMATION - Auto-linking resource-ref 'java:comp/env/jdbc/dezentral.xa'
> in
> bean someproject3-ejb.Comp719146276 to Resource(id=My DataSource)
> INFORMATION - Configuring PersistenceUnit(name=someprojectPU)
> INFORMATION - Adjusting PersistenceUnit someprojectPU <jta-data-source> to
> Resource ID 'My DataSource' from 'jdbc/dezentral.xa'
> INFORMATION - Adjusting PersistenceUnit someprojectPU <non-jta-data-source>
> to Resource ID 'My Unmanaged DataSource' from 'null'
> SCHWERWIEGEND - ERROR ... null: Cannot validate jar: null
> SCHWERWIEGEND - Invalid AppModule(name=, path=)
> INFORMATION - Set the 'openejb.validation.output.level' system property to
> VERBOSE for increased validation details.
> WARNUNG - configureApplication.loadFailed
> INFORMATION - Closing DataSource: My DataSource
> INFORMATION - Closing DataSource: My Unmanaged DataSource
> INFORMATION - Closing DataSource: someproject_junit
>
> Many Thanks!
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/
> ValidationException-due-to-META-INF-validation-xml-s-url-
> capitalization-tp4681940.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ValidationException due to META-INF/validation.xml's url capitalization

some user
Romain Manni-Bucau wrote
is it intended it is not the same URLs? (someproject3 vs someproject)
No, that was a typo when I composed this message, sorry. Correct would have been "someproject3" in both URLs, so that they're completely equal, apart from the case.

Romain Manni-Bucau wrote
First thing I'd do is to check why the case is different, even if openejb
tries to absorb that it is generally an issue when launching the command
line/created the classpath.
I guess the problem is the classloader used by the JUnit runner (windows / Eclipse), which is outside of the OpenEJB ecosystem. Hence, it discovers the lowercased URL from the ejbModule, as well as the not-lowercased URL from the project folder via its eclipse run configuration, which leads to the problem in the validation framework.

Romain Manni-Bucau wrote
If still an issue you can probably use as you mentionned arquillian or
ApplicationComposer but EJBContainer normally works when the JVM is not
corrupted (if you use eclipse, give it a try outside eclipse too).
I tried executing the tests with maven (surefire plugin), but still the same.
Ugly but interesting: I found out that I can get the code working when tricking OpenEJB into thinking it's on a non-windows os, by supplying VM parameters -Dos.name=foo.

I have to think about if I want to use that as a strategy, or accept the additional complexity of arquillian or the ApplicationComposer.

Anyway: many thanks for supporting!


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ValidationException due to META-INF/validation.xml's url capitalization

Romain Manni-Bucau
we can surely add a flag to not lowercase anymore the url, it is actually
really less useful now we rewritten part of the scanning - doubt I have is
about java 9 which can still require it.


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-06-23 7:57 GMT+02:00 some user <[hidden email]>:

> Romain Manni-Bucau wrote
> > is it intended it is not the same URLs? (someproject3 vs someproject)
>
> No, that was a typo when I composed this message, sorry. Correct would have
> been "someproject3" in both URLs, so that they're completely equal, apart
> from the case.
>
>
> Romain Manni-Bucau wrote
> > First thing I'd do is to check why the case is different, even if openejb
> > tries to absorb that it is generally an issue when launching the command
> > line/created the classpath.
>
> I guess the problem is the classloader used by the JUnit runner (windows /
> Eclipse), which is outside of the OpenEJB ecosystem. Hence, it discovers
> the
> lowercased URL from the ejbModule, as well as the not-lowercased URL from
> the project folder via its eclipse run configuration, which leads to the
> problem in the validation framework.
>
>
> Romain Manni-Bucau wrote
> > If still an issue you can probably use as you mentionned arquillian or
> > ApplicationComposer but EJBContainer normally works when the JVM is not
> > corrupted (if you use eclipse, give it a try outside eclipse too).
>
> I tried executing the tests with maven (surefire plugin), but still the
> same.
> Ugly but interesting: I found out that I can get the code working when
> tricking OpenEJB into thinking it's on a non-windows os, by supplying VM
> parameters -Dos.name=foo.
>
> I have to think about if I want to use that as a strategy, or accept the
> additional complexity of arquillian or the ApplicationComposer.
>
> Anyway: many thanks for supporting!
>
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/
> ValidationException-due-to-META-INF-validation-xml-s-url-capitalization-
> tp4681940p4681948.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ValidationException due to META-INF/validation.xml's url capitalization

some user
Romain Manni-Bucau wrote
we can surely add a flag to not lowercase anymore the url, it is actually
really less useful now we rewritten part of the scanning - doubt I have is
about java 9 which can still require it.
I would be glad about such a flag, since it would solve my problem and I could use the embedded container "from scratch" for some junit and integration testing, at least for the start of my testing infrastructure.
Anything I can do to support you?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ValidationException due to META-INF/validation.xml's url capitalization

Romain Manni-Bucau
created https://issues.apache.org/jira/browse/TOMEE-2076


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-06-26 7:52 GMT+02:00 some user <[hidden email]>:

> Romain Manni-Bucau wrote
> > we can surely add a flag to not lowercase anymore the url, it is actually
> > really less useful now we rewritten part of the scanning - doubt I have
> is
> > about java 9 which can still require it.
>
> I would be glad about such a flag, since it would solve my problem and I
> could use the embedded container "from scratch" for some junit and
> integration testing, at least for the start of my testing infrastructure.
> Anything I can do to support you?
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/
> ValidationException-due-to-META-INF-validation-xml-s-url-capitalization-
> tp4681940p4681956.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Loading...