Reputation: 5592
javax.naming.NameNotFoundException: While trying to look up comp/env/myPackage.ServiceImpl/eventQuery in /app/ejb/my-dao-2016.jar/#MyDaoImpl.; remaining name 'comp/env/myPackage/ServiceImpl/eventQuery'
I'm working on Weblogic 12.2.1 now, and I get this error (and others like that, for every EJB in the application). EJBs are visible when I go into deployment summary, point is that they are under my-ear
not my-dao
, I have no idea why weblogic is looking there, my-dao
has nothing to do with eventQuery
. I tried to specifying a name/mappedName/lookup in the annotations, nothing works. I think that if I somehow manage to tell it to look in /app/ejb/my-ear.jar
, not in /app/ejb/my-dao-2016.jar
then everything will be fine, but I have no idea where to do that. Here's some code, but it's all pretty straightforward, I have no ejb.xml
or anything like that, just annotations.
Oh, and probably the most important thing, everything works perfectly on Weblogic 12.1.3.
public class ServiceImpl implements Service {
@EJB
private EventQuery eventQuery;
...
}
@Stateless
@Local(EventQuery.class)
public class EventQueryImpl implements EventQuery {
...
}
public interface EventQuery {
...
}
Upvotes: 0
Views: 1411
Reputation: 51
This problem is caused by a bug/change in Weblogic: BUG:22988141 - DEPENDENCY INJECTION IS FAILED WHEN DEPLOYING APPLICATION
The differences of behavior between 12.2.1 and 12.1.3 comes from differences of CDI support version: WLS 12.1.3 supports CDI 1.0 WLS 12.2.1 supports CDI 1.1
There are 2 solutions:
Add beans.xml like follows into application to find MDB.
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all"
version="1.1">
beans-discovery-mode="all" (default "annotated") or modify configuration
<domain>
...
<cdi-container>
.
<implicit-bean-discovery-enabled>false</implicit-bean-discovery-enabled>
.
</cdi-container>
...
</domain>
The modification can be done via the console. Then WLS 12.2.1 disables CDI.
Upvotes: 2