No EJB receiver available for handling ...
No EJB receiver available for handling ...
Jboss EAP 6에서 원격 EJB를 호출할 때 이 오류가 발생했습니다. 왜냐하면 JNDI 형식이 잘못 썼기 때문입니다.EJB JNDI의 형식은 다음과 같습니다.
ejb:///!?stateful
appName 앞에는 "/"이 없습니다.distinctName이 없으면 비어 있습니다. 즉, 두 개의 "//"연속입니다.
jboss-eap-quickstarts-6.4.0.GA는 예제 코드 jb-remote를 제공합니다:
public interface RemoteCalculator {
    int add(int a, int b);
    int subtract(int a, int b);
}
@Stateless
@Remote(RemoteCalculator.class)
public class CalculatorBean implements RemoteCalculator {
    @Override
    public int add(int a, int b) {
        return a + b;
    }
    @Override
    public int subtract(int a, int b) {
        return a - b;
    }
}
public class RemoteEJBClient {
    public static void main(String[] args) throws Exception {
        // Invoke a stateless bean
        invokeStatelessBean();
        // Invoke a stateful bean
        invokeStatefulBean();
    }
    private static void invokeStatelessBean() throws NamingException {
        // Let's lookup the remote stateless calculator
        final RemoteCalculator statelessRemoteCalculator = lookupRemoteStatelessCalculator();
        System.out.println("Obtained a remote stateless calculator for invocation");
        // invoke on the remote calculator
        int a = 204;
        int b = 340;
        System.out.println("Adding " + a + " and " + b + " via the remote stateless calculator deployed on the server");
        int sum = statelessRemoteCalculator.add(a, b);
        System.out.println("Remote calculator returned sum = " + sum);
        if (sum != a + b) {
            throw new RuntimeException("Remote stateless calculator returned an incorrect sum " + sum + " ,expected sum was "
                    + (a + b));
        }
        // try one more invocation, this time for subtraction
        int num1 = 3434;
        int num2 = 2332;
        System.out.println("Subtracting " + num2 + " from " + num1
                + " via the remote stateless calculator deployed on the server");
        int difference = statelessRemoteCalculator.subtract(num1, num2);
        System.out.println("Remote calculator returned difference = " + difference);
        if (difference != num1 - num2) {
            throw new RuntimeException("Remote stateless calculator returned an incorrect difference " + difference
                    + " ,expected difference was " + (num1 - num2));
        }
    }
...
    private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException {
        final Hashtable jndiProperties = new Hashtable();
        jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
        final Context context = new InitialContext(jndiProperties);
        return (RemoteCalculator) context.lookup("ejb:/jboss-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName());
    }
...
}
    jboss-ejb-client.properties (resources 루트 디렉터리에 놓기)
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false  Client pom.xml
    
      
         
            org.jboss.spec 
            jboss-javaee-6.0 
            ${version.jboss.spec.javaee.6.0} 
            pom 
            import 
          
         
             org.jboss.as 
             jboss-as-ejb-client-bom 
             ${version.jboss.as} 
             pom 
             import 
          
       
    
   
       
      
         org.jboss.spec.javax.transaction 
         jboss-transaction-api_1.1_spec 
         runtime 
       
      
      
         org.jboss.spec.javax.ejb 
         jboss-ejb-api_3.1_spec 
         runtime 
       
       
       
          org.jboss.quickstarts.eap 
          jboss-ejb-remote-server-side 
          ejb-client 
         ${project.version} 
        
       
       
           org.jboss 
           jboss-ejb-client 
           runtime 
        
       
       
           org.jboss.xnio 
           xnio-api 
           runtime 
        
       
           org.jboss.xnio 
           xnio-nio 
           runtime 
        
      
       
            org.jboss.remoting3 
            jboss-remoting 
            runtime 
         
        
        
            org.jboss.sasl 
            jboss-sasl 
            runtime 
         
        
        
            org.jboss.marshalling 
            jboss-marshalling-river 
            runtime 
         
       예는 jboss에 jboss 패키지로 배치된 것입니다. jboss 로그를 보면 다음과 같은 것을 찾을 수 있습니다.
java:jboss/exported/jboss-ejb-remote-server-side/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
jar 패키지 형식으로 배치, 접근 시 쓰기:
context.lookup("ejb:/jboss-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName());  나는 그것을 ear로 옮겨서 다음과 같이 썼다.
context.lookup("ejb:/myear/myejb/CalculatorBean!" + RemoteCalculator.class.getName());  No EJB receiver available for handling..."/"를 빼야 합니다.
참고: 기본적으로 WildFly는 8080을 리모팅 포트로 사용합니다.The EJB client API uses the http port, with the http-upgrade functionality, for communicating with the server for remote invocations(unless the server is configured for some other http port)
자세한 내용은 을 참조하십시오.
EJB JNDI Naming Reference
Invoke a Session Bean Remotely using JNDI(EAP 6)
EJB invocations from a remote client using JNDI(Wildfly 8)
Remote EJB invocations via JNDI - EJB client API or remote-naming project
Download the Quickstart Code Examples
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Jboss Marshalling 서버 에서 메 시 지 를 받 아들 일 수 없습니다.이전 에는 message Pack 직렬 화 프레임 워 크 를 사 용 했 는데 오늘 은 그 jboss Marshalling 직렬 화 프레임 워 크 를 보고 싶 습 니 다. 화면 음악 nrepository 에서[mars...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.