Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"JNDI name is already in use" in Weblogic 12c with EJB3

I have the following code that I'm trying to deploy as an EJB to WebLogic 12c, but I'm getting an error:

"Error deploying the EJB GeopoliticalServiceBean(Application: campaigner-ejb, EJBComponent: campaigner-service.jar), the JNDI name java:global/campaigner-ejb/campaigner-service/GeopoliticalServiceBean!com.dr_dee_sw.campaigner.service.GeopoliticalServiceLocal is already in use. You must set a different JNDI name in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation for this EJB before it can be deployed."

public interface GeopoliticalService
{
...
}

@Local
public interface GeopoliticalServiceLocal extends GeopoliticalService
{
}

@Remote
public interface GeopoliticalServiceRemote extends GeopoliticalService
{
}

@TransactionManagement(value = TransactionManagementType.CONTAINER)
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
@Stateless
public class GeopoliticalServiceBean implements GeopoliticalServiceLocal,GeopoliticalServiceRemote
{
...
}

More information: I've reduced the EJB-JAR file, campaigner-service.jar, so that there's only one bean in it, plus the interfaces and exceptions. the EAR file, campaigner-ejb.ear, has only the EJB-JAR in it at the main level. It also has a "lib" directory with supporting libraries, but it only has the DAO and DTO jars in it plus third-party libraries. So, to me, it doesn't seem like a packaging issue.

This is my first app using all annotations, but it still seems fairly straight-forward. What am I missing?

like image 888
Gary Kephart Avatar asked Jul 21 '15 18:07

Gary Kephart


2 Answers

During the migration from Weblogic 10 to Weblogic 12 we faced the same issue. We could reproduce the issue by deploying the EAR on a fresh server without the datasources configured properly; this would cause a NameNotFoundException during deployment. Every next attempt to deploy the EAR would result in the JDNI name is already in use, even after restarting, undeploying, redeploying.

The only thing that resolved the issue was removing the cache (and most importantly the EJBCompilerCache) and tmp folder of the target server.

like image 126
P_W999 Avatar answered Oct 01 '22 23:10

P_W999


WebLogic caches artefacts even if they are undeployed (deleted). The solution is to remove the caches.

Solution

For each domain you should remove the cached artefacts. For example for svc domain, stop all the servers (Admin and managed), then Execute the following to delete the tmp and EJB caches.

cd /data/weblogic/Oracle/products/Oracle_Home/fusion/user_projects/domains/svc
rm -fr ./servers/svc_srv1/cache/EJBCompilerCache
rm -fr ./servers/Administrator/cache/EJBCompilerCache
rm -fr ./servers/AdminServer/tmp
rm -fr ./servers/svc_srv1/tmp

Otherwise, from weblogic admin console, go to Home >Summary of Servers >YOUR_DOMAIN_NAME and then on EJBs tab tick Force Generation to true

like image 40
Rambou Avatar answered Oct 01 '22 23:10

Rambou