Answer the question
In order to leave comments, you need to log in
Unit tests not working
There is a large multi-module Java EE application on maven. They use junit to test beans. But all of a sudden it stopped working. Thrown with exception:
org.apache.openejb.OpenEjbContainer$InitializationException: java.lang.IllegalArgumentException
at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:442)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer .java:76)
at en.simplgroupp.ejb.TestRules.setUp(TestRules.java:71)
@EJB
Bean1Local bean1;
@EJB
Bean2Local bean2;
@EJB
Bean3Local bean3;
@Before
public void setUp() throws Exception {
System.setProperty("javax.xml.bind.JAXBContext","com.sun.xml.internal.bind.v2.ContextFactory");
final Properties p = new Properties();
p.put(/*настройки бд*/);
p.put(/*настройки бд*/);
p.put(/*настройки бд*/);
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
final Context context = EJBContainer.createEJBContainer(p).getContext();
context.bind("inject", this);
bean1 = (Bean1Local) context.lookup("java:global/Module1-Name!ru.package_name.Bean1Local");
bean2 = (Bean2Local) context.lookup("java:global/Module2-Name!ru.package_name.Bean2Local");
bean3 = (Bean3Local) context.lookup("java:global/Module3-Name!ru.package_name.Bean3Local");
}
Answer the question
In order to leave comments, you need to log in
After so much time, I figured out the problem. The root lies in the 8th JDK. For it, OpenEJB must be a newer version.
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>4.7.2</version>
<scope>test</scope>
</dependency>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question