问题描述
我正在使用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 (将#修改为@)