Ejb consumption in JDK1.4

时光毁灭记忆、已成空白 提交于 2019-12-25 02:23:01

问题


As a postlude to Consuming an EJB question. I have created an ejb on JBOSS AS 6.0 and am consuming it in a java client using the following code.

private ServiceLocator(String host, String principal, String creadentials) throws NamingException {
        Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
        env.put(Context.URL_PKG_PREFIXES,
                "org.jboss.naming:org.jnp.interfaces");
        env.put(Context.PROVIDER_URL, "jnp://" + host);
        System.out.println("jnp://" + host);
        env.put(Context.SECURITY_PRINCIPAL, principal);
        env.put(Context.SECURITY_CREDENTIALS, creadentials);
        env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                "org.jboss.security.jndi.JndiLoginInitialContextFactory");
        InitialContext ct = new InitialContext(env);
        cachedStructSpeechRemote = (StructSpeechRemote) ct.lookup("eCWServicesEAR/StructSpeechService/remote-com.ecw.ejb.StructSpeechRemote");
    }

The consumer uses JBOSS-all-client.jar present in client folder of JBoss AS6.0. I am not able to use the same code with JDK1.4 because the jar is not JDK 1.4 compatible. I have also tried to get the jar file form the older distribution of JBoss AS but than it does not work with the newer distribution of the server:( Is there a way to write an EJB consumer which is JDK version independent (May be also vendor independent!) and can work in all JDKs ranging from 1.4 to 6?


回答1:


In your case I would expose the EJB on JBoss as a web service to be able to call it from any jvm. Otherwise you can try to find more info here: https://issues.jboss.org/browse/EJBTHREE-1029?focusedCommentId=12371962



来源:https://stackoverflow.com/questions/7117473/ejb-consumption-in-jdk1-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!