2017-04-27 8 views
1

TomEE 7.0.3 서버에서 실행중인 ejb가 있습니다. btw,이 모든 것은 Tomee 1.7.4에서 작동했습니다. 나는 설정을 내가 사용자 관리 '에 대한 자격 증명을 제공하여 URL http://127.0.0.1/tomee/ejb에 액세스 할 수 오전 바람둥이-users.xml에서 파일TomEE에서 원격으로 EJB를 호출 할 때 AuthenticationException이 발생하는 이유는 무엇입니까?

<tomcat-users> 
    <role rolename="admin" /> 
    <role rolename="admin-gui" /> 
    <role rolename="admin-script" /> 
    <role rolename="manager" /> 
    <role rolename="manager-gui" /> 
    <role rolename="manager-script" /> 
    <role rolename="manager-jmx" /> 
    <role rolename="manager-status" /> 
    <role rolename="tomee-admin" /> 
    <user 
     name="admin" 
     password="admin" 
     roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status,tomee-admin" /> 
    <role rolename="tomcat" /> 
    <user 
     name="tomcat" 
     password="tomcat" 
     roles="tomcat" /> 
    <user 
     name="manager" 
     password="manager" 
     roles="manager" /> 
</tomcat-users> 

를 사용하여 사용자의 집합을 가지고있다. 내 server.xml 파일이 다음 항목

<Resource auth="Container" description="User database that can be updated and saved" 
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" 
    pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" /> 

<Realm className="org.apache.catalina.realm.LockOutRealm"> 
     <!-- This Realm uses the UserDatabase configured in the global JNDI resources 
      under the key "UserDatabase". Any edits that are performed against this UserDatabase 
      are immediately available for use by the Realm. --> 
     <Realm className="org.apache.catalina.realm.UserDatabaseRealm" 
      resourceName="UserDatabase" /> 
    </Realm> 

I 원격 EJB를 호출 할 때 문제가있다, 내 JNDI InitialContext를 다음과 같은 속성을 사용합니다.

java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory 
java.naming.provider.url=http://127.0.0.1:8082/tomee/ejb 
java.naming.security.principal=admin 
java.naming.security.credentials=admin 

다음은 ejb를 호출하기위한 코드입니다.

public static Object locateService(String serviceName) throws NamingException, IOException { 
    InputStream in = ServiceLocator.class.getClassLoader().getResourceAsStream("servicelocator.properties"); 
    Properties p = new Properties(); 
    p.load(in); 
    InitialContext ctx = new InitialContext(p); 
    return ctx.lookup("PaymentManagerRemote"); 
} 

당신은 내가 올바른 사용자 이름과 암호를 제공하고 있지만이

Apr 27, 2017 12:39:07 PM org.apache.openejb.client.EventLogger log 
INFO: RemoteInitialContextCreated{providerUri=http://127.0.0.1:8082/tomee/ejb} 
Exception in thread "main" javax.naming.AuthenticationException: Error while communicating with server: ; nested exception is: 
    javax.naming.AuthenticationException 
    at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:381) 
    at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:289) 
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) 
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) 
    at javax.naming.InitialContext.init(InitialContext.java:244) 
    at javax.naming.InitialContext.<init>(InitialContext.java:216) 
    at co.uk.meghdoot.core.util.ServiceLocator.locateService(ServiceLocator.java:20) 
    at co.uk.meghdoot.core.test.DeviceLocationTest.setUp(DeviceLocationTest.java:53) 
    at co.uk.meghdoot.core.test.DeviceLocationTest.main(DeviceLocationTest.java:109) 

사람이 되거 수

다음과 같은 예외를 얻을 볼 수 있듯이?

답변

0

tomcat-users.xml을 사용하면 server.xml에서 UserDatabaseRealm을 realm으로 사용한다고 가정합니다. 질문에 쓰여지지 않았을 수도 있습니다. 또한 인증은 servlet/tomcat 백본을 통해 수행된다고 가정합니다. tomee webapp에 물리적으로 추가하고 ejbd 서블릿을 정의 할 때까지는 기본적으로 그렇지 않습니다 (http://tomee.apache.org/ejbd-transport.html - request.login()을 수행하는 필터 참조

) ejbd 프로토콜을 사용하면 tomee가 자동으로 로그인됩니다 기본적으로 server.xml의 첫 번째 영역에 의존하는 tomee 보안 서비스를 사용합니다.

+0

내가 얻은 오류는 내가 보낸 AuthenticationException이며 직렬화 오류가 아닙니다. 화이트리스트와 블랙리스트, 원격 ejb를 호출 할 수 있어야합니다. 기본 블랙리스트는 변경없이 작동해야합니다. – Ajay

+0

jaas도 올바르게 설정 되었습니까? (JVM 시스템 속성 + JAASRealm)? –

+0

아니요, JAAS 영역을 설정하지 않았습니다. 그것 tomee의 새 버전에 대한 요구 사항은 무엇입니까? 당신은 어떤 문서를 가리킬 수 있습니까? – Ajay