如何解决Apache-Tomee-plume-8.0.2-无法通过RemoteInitialContextFactory调用EJB
我正在使用Apache Apache-Tomee-plume-8.0.2,并尝试通过RemoteInitialContextFactory调用我的EJB。
尝试从我的Swing应用程序调用EJB时得到以下异常。需要帮助来解决此问题。
WARNING: RequestFailed{server=http://127.0.0.1:8080/tomee/ejb} JNDI_LOOKUP:global/server-1.0-SNAPSHOT/CustomerFacade!org.vaadin.backend.ejb.CustomerFacadeRemote {error=Prematurely reached the end of the stream. OEJP/4.6 : Unable to read protocol version. Reached the end of the stream.} Exception in thread "main" org.apache.openejb.client.ClientRuntimeException: **Invalid response from server: -1** at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:468) at javax.naming.InitialContext.lookup(InitialContext.java:417) at org.vaadin.swingersclub.SwingApplication.getCustomerFacade(SwingApplication.java:149) at org.vaadin.swingersclub.SwingApplication.refreshData(SwingApplication.java:138) at org.vaadin.swingersclub.SwingApplication.createUI(SwingApplication.java:130) at org.vaadin.swingersclub.SwingApplication.main(SwingApplication.java:50)
protected Properties getJndiPropsCustomerServer() {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL,"http://127.0.0.1:8080/tomee/ejb");
return props;}
Public CustomerFacadeRemote getCustomerFacade() {
if (customerFacade == null) {
try {
final Object ref = new InitialContext(
getJndiPropsCustomerServer()).lookup(
"CustomerFacadeRemote");
customerFacade = (CustomerFacadeRemote) PortableRemoteObject.
narrow(ref,CustomerFacadeRemote.class);
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
}
return customerFacade;
}
tomee.remote.support = true
tomee.serialization.class.blacklist = -
tomee.serialization.class.whitelist = *
openejb.system.apps = true
openejb.servicemanager.enabled = true
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。