Setting openejb.additional.exclude=runtime-6.1 causes the following exception:
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at
org.apache.openejb.config.NewLoaderLogic.getExclusions(NewLoaderLogic.java:222)
at
org.apache.openejb.config.NewLoaderLogic.applyBuiltinExcludes(NewLoaderLogic.java:165)
at
org.apache.openejb.config.NewLoaderLogic.applyBuiltinExcludes(NewLoaderLogic.java:161)
at
org.apache.openejb.config.DeploymentsResolver.loadFromClasspath(DeploymentsResolver.java:238)
at
org.apache.openejb.config.ConfigurationFactory.getModulesFromClassPath(ConfigurationFactory.java:564)
at
org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:512)
at
org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:337)
... 28 more
which I assume has something to do with it being an AbstractList:
/**
* {@inheritDoc}
*
* <p>This implementation always throws an
* {@code UnsupportedOperationException}.
*
* @throws UnsupportedOperationException {@inheritDoc}
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public void add(int index, E element) {
throw new UnsupportedOperationException();
}
I'm using OpenEJB core 4.5.1:
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>4.5.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>slf4j-jdk14</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-4</version>
<scope>provided</scope>
</dependency>
-----Original Message-----
From: Romain Manni-Bucau [mailto:[email protected]]
Sent: Monday, August 11, 2014 11:07 AM
To: [email protected]
Subject: Re: How to exclude jar from module search?
Hi
you can use -Dopenejb.additional.exclude=runtime-6.1 IIRC.
deployments.classpat properties works in openejb but are hard to configure
(path) and doesnt work in tomee.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-08-11 16:26 GMT+02:00 Chambery, Todd <[email protected]>:
> Hi,
>
> I posted the below question to StackOverflow
> (http://stackoverflow.com/questions/25187808/openejb-how-to-exclude-jar-from-module-search),
> but maybe I have a better chance to get a response here:
>
>
> I use OpenEJB to run unit tests for applications ultimately deployed to
> WebSphere Application Server. My problem is a(n unavoidable) dependency on
> the WAS runtime jar. I've added an expression to the exclude property (I've
> also tried the physical path):
>
> p.put("openejb.deployments.classpath.exclude", ".*?runtime-6.1.*?");
> // p.put("openejb.deployments.classpath.exclude",
> "C:/Users/user/.m3/repository/was/runtime/6.1/runtime-6.1.jar");
> p.put("openejb.exclude-include.order", "include-exclude");
>
> This value is confirmed in the logs:
>
> OpenEJB.options-2014-08-07-main--INFO -OpenEJB.options:Using
> 'openejb.exclude-include.order=include-exclude'
> OpenEJB.options-2014-08-07-main--INFO -OpenEJB.options:Using
> 'openejb.deployments.classpath.include=.*eed-jar.*'
> OpenEJB.options-2014-08-07-main--INFO -OpenEJB.options:Using
> 'openejb.deployments.classpath.exclude=.*?runtime-6.1.*?'
>
> but the jar is still being inspected for loadable modules:
>
> OpenEJB.startup.config-2014-08-07-main--INFO
> -OpenEJB.startup.config:Found EjbModule in classpath:
> C:\Users\user\.m3\repository\was\runtime\6.1\runtime-6.1.jar
>
> The result is startup failure for OpenEJB:
>
> org.apache.openejb.OpenEjbContainer$InvalidApplicationException:
> org.apache.openejb.config.ValidationFailedException: Module failed
> validation. AppModule(name=) and
> WARNING: can't load com.ibm.ws.management.j2ee.ManagementBean
> org.apache.openejb.OpenEJBRuntimeException: Management
>
> I've been creating a 0-length dummy file and renaming runtime-6.1.jar to
> execute the tests in Eclipse, but I need to restore the jar to run the Maven
> build (which Eclipse will then bind to, necessitating a restart to rename the
> jar).
>
> What's the right way to exclude this jar?
>
> Thanks,
> Todd
>
> ----------------------------------------------------------------------
> This message, and any attachments, is for the intended recipient(s) only, may
> contain information that is privileged, confidential and/or proprietary and
> subject to important terms and conditions available at
> http://www.bankofamerica.com/emaildisclaimer. If you are not the intended
> recipient, please delete this message.
----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may
contain information that is privileged, confidential and/or proprietary and
subject to important terms and conditions available at
http://www.bankofamerica.com/emaildisclaimer. If you are not the intended
recipient, please delete this message.