weblogic ejb ComplianceException

不打扰是莪最后的温柔 提交于 2019-12-22 17:59:32

问题


I try to deploy an application which uses EJB on weblogic 10.3. I use the framework seam 2.2.0

I created an EJB project and en EAR project with workshop.

When I compile the project, I get this error:

weblogic.ejb.container.compliance.ComplianceException: No business interface, component interface or web service endpoint interface found for Session Bean Authenticator

Here is the bean code:

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.contexts.SessionContext;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.faces.Redirect;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Credentials;
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.crypto.BinTools;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.management.JpaIdentityStore;

@Stateless
@Local
@Name("authenticator")
public class Authenticator {
}

And here is the exception:

weblogic.ejb.container.compliance.ComplianceException: No business interface, component interface or web service endpoint interface found for Session Bean Authenticator
    at weblogic.ejb.container.compliance.SessionBeanClassChecker.checkInterfacesExist(SessionBeanClassChecker.java:177)
    at weblogic.ejb.container.compliance.Ejb30SessionBeanClassChecker.checkInterfacesExist(Ejb30SessionBeanClassChecker.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:337)
    at weblogic.ejb.container.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:286)
    at weblogic.ejb.container.ejbc.EJBCompiler.complianceCheckJar(EJBCompiler.java:952)
    at weblogic.ejb.container.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:920)
    at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:246)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:552)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:519)
    at weblogic.ejb.container.deployer.EJBDeployer.runEJBC(EJBDeployer.java:393)
    at weblogic.ejb.container.deployer.EJBDeployer.compileJar(EJBDeployer.java:715)
    at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:618)
    at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1154)
    at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:425)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


    at weblogic.ejb.container.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:327)
    at weblogic.ejb.container.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:286)
    at weblogic.ejb.container.ejbc.EJBCompiler.complianceCheckJar(EJBCompiler.java:952)
    at weblogic.ejb.container.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:920)
    at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:246)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:552)
    at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:519)
    at weblogic.ejb.container.deployer.EJBDeployer.runEJBC(EJBDeployer.java:393)
    at weblogic.ejb.container.deployer.EJBDeployer.compileJar(EJBDeployer.java:715)
    at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:618)
    at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1154)
    at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:425)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
> 

Here is my ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
         version="3.0">       
   <interceptors>
      <interceptor>
         <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor>
   </interceptors>

   <assembly-descriptor>
      <interceptor-binding>
         <ejb-name>Authentificator<ejb-name>
         <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
   </assembly-descriptor>
</ejb-jar>

I don't understand my error.

Thanks for your help.


回答1:


This happens because Weblogic is looking for an interface that Authenticator implements.

Change to:

@Stateless
@Name("authenticator")
public class Authenticator implements AuthenticatorLocal {

    @Override
    public void oneMethod()
    {
      //enter code here
    }
}

@Local
public interface AuthenticatorLocal {
    void oneMethod();
}

Note: the interface must have at least one overridden method, otherwise you'll get the same error again.




回答2:


Happens because weblogic will search for an interface for EJB Local service:

@Stateless
@Local
@Name("authenticator")
public class Authenticator {
}

if you implement an interface, and provide it to EJB this problem is solved. Like this:

@Stateless
@Local(IAuthenticator.class)
@Name("authenticator")
public class Authenticator implements IAuthenticator{
 //your business logic
}

public interface IAuthenticator {
   // interface
}


来源:https://stackoverflow.com/questions/3238621/weblogic-ejb-complianceexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!