2

I have a project with a EJB implementing a JWS Webservice, like this:

@Stateless
@Remote(WebServiceTest.class)
@WebService(
 serviceName="TestService",
 name="TestName"
)
public class WebServiceTestImpl implements WebServiceTest {
 @Override
 @WebMethod(operationName="hello")
 public String hello() {
  return "Hello World!";
 }
}

I deploy and test this perfectly on WebLogic 10.3 using a simple EAR project. Now I need to use Hibernate on my project, so from previous experiences I know that I have to use Antrl from Hibernate and not from the container, so I create a weblogic-application.xml in the EAR project:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application ...>
 <wls:prefer-application-packages>
  <wls:package-name>antlr.*</wls:package-name>
 </wls:prefer-application-packages>
</wls:weblogic-application>

Now when I deploy the EAR I get this error:

Unable to deploy EJB: WebServiceTestImpl from test-1.0.0-SNAPSHOT.jar:

***** ASSERTION FAILED *****


 at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:467)
 at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
 at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
 at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:149)
 Truncated. see log file for complete stacktrace

Caused By: java.lang.ClassNotFoundException: test.WebServiceTestImpl_zd33dy_WSOImpl
 at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:280)
 at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:253)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
 Truncated. see log file for complete stacktrace

How can I solve this? If I don't put Antlr in wls:prefer-application-packages Hibernate will not work, and if I put it I cannot deploy the webservice...

Vinicius
  • 1,060
  • 1
  • 12
  • 21

3 Answers3

6

Weblogic somehow keeps precompiled versions of EJBs even though you do a new/update deployment.

this works for me with wls 10.3.5: within the server directory of your domain (e.g. in my case /home/myUser/apps/bea/domains/myDomain/servers/AdminServer) there is a subfolder "cache/EJBCompilerCache". Stop your weblogic instance and remove the contents of this subfolder. Restart weblogic and everything will work :-)

Korgen
  • 5,191
  • 1
  • 29
  • 43
2

I'm not sure if this is the same bug, but there is a known bug in Weblogic 10.3.0-2 that causes a problem when using JaxWS with an EJB v 2.x. But I'm getting a near identical error when I put the @WebService annotation on an EJB v 3.0 on Weblogic 10.3.1. The error is loading what looks like the supposedly generated local stubs that Weblogic creates, and its happening on Weblogic 10.3.0, 10.3.1, 10.3.2, and 10.3.3. (yes, I really have them all deployed ;)

mezmo
  • 2,441
  • 19
  • 22
  • It seems that the problem is exactly with the local stubs :( The only solution I found was to create an WS that has no dependency on Hibernate, the WS actually posts things over a JMS queue that will be processed by another project which uses Hibernate. – Vinicius Jan 05 '11 at 14:33
0

I had this problem deploying session bean and then trying to convert it to web service. WebLogic seems to cache session beans somehow.

There are several solution to this:
- Rename slsb.
- Comment @Stateless and @Remote annotations, deploy application, uncomment annotations, redeploy again.
- Bounce WebLogic.

maksymus
  • 1
  • 1