javax.naming.NameNotFoundException 在 tomee plume ejb 3.0 和网络服务中
javax.naming.NameNotFoundException in tomee plume ejb 3.0 and webservices
我在同一 EAR 的 Tomee plume 中部署了一个 Web 服务项目和一个 EJB 3.0 项目。
从 webservice class 我正在使用远程接口调用 EJB bean class。
我使用了多个 InitialContextFactory 对象,但似乎没有任何效果。每次我得到
javax.naming.NameNotFoundException: 找不到名称 "TestRemote"
部署时,此日志正在服务器中。
2017 年 9 月 8 日 16:23:09.587 信息 [main] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=TestRemote) --> Ejb(deployment-id=Test)
这是来自我的网络服务的代码 class
Properties properties = new Properties();
properties.put("java.naming.factory.initial", "org.apache.openejb.core.OpenEJBInitialContextFactory");
properties.put("java.naming.provider.url", "http://localhost:8081");
InitialContext ic = new InitialContext(properties);
TestRemote PSBR = (TestRemote) ic.lookup("TestRemote");
除了 OpenEJBInitialContextFactory,我还尝试了 org.apache.openejb.core.LocalInitialContextFactory 和 RemoteInitialContextFactory 但每次都出现相同的错误。
我使用了这段代码并在 system.properties 中进行了更改,它得到了解决。
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
properties.put(Context.PROVIDER_URL, "http://127.0.0.1:8081/tomee/ejb");
并更改 system.properties。
# allowed packages to be deserialized, by security we denied all by default, tune tomee.serialization.class.whitelist packages to change it
tomee.remote.support = true
tomee.serialization.class.whitelist = *
tomee.serialization.class.blacklist = -
我在同一 EAR 的 Tomee plume 中部署了一个 Web 服务项目和一个 EJB 3.0 项目。 从 webservice class 我正在使用远程接口调用 EJB bean class。 我使用了多个 InitialContextFactory 对象,但似乎没有任何效果。每次我得到
javax.naming.NameNotFoundException: 找不到名称 "TestRemote"
部署时,此日志正在服务器中。
2017 年 9 月 8 日 16:23:09.587 信息 [main] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=TestRemote) --> Ejb(deployment-id=Test)
这是来自我的网络服务的代码 class
Properties properties = new Properties();
properties.put("java.naming.factory.initial", "org.apache.openejb.core.OpenEJBInitialContextFactory");
properties.put("java.naming.provider.url", "http://localhost:8081");
InitialContext ic = new InitialContext(properties);
TestRemote PSBR = (TestRemote) ic.lookup("TestRemote");
除了 OpenEJBInitialContextFactory,我还尝试了 org.apache.openejb.core.LocalInitialContextFactory 和 RemoteInitialContextFactory 但每次都出现相同的错误。
我使用了这段代码并在 system.properties 中进行了更改,它得到了解决。
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
properties.put(Context.PROVIDER_URL, "http://127.0.0.1:8081/tomee/ejb");
并更改 system.properties。
# allowed packages to be deserialized, by security we denied all by default, tune tomee.serialization.class.whitelist packages to change it
tomee.remote.support = true
tomee.serialization.class.whitelist = *
tomee.serialization.class.blacklist = -