Yes, you are right.
in servlet:
...
private beanRemote beanBean = null;
....
protected int init(HttpServletRequest request){
Properties props;
Context ctx;
HttpSession session;
Properties props = new Properties();
int ret = -1;
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL,"ejbd://192,168.0.200:4201");
session = request.getSession(true);
beanBean = (beanRemote) session.getAttribute("beanBean");
if (beanBean == null) {
try {
ctx = new InitialContext(props);
beanBean = (beanRemote)ctx.lookup("beanBeanRemote");
session.setAttribute("beanBean", beanBean);
ret = 0;
} catch (NamingException ex) {
ex.printStackTrace();
}
} else {
ret = 1;
}
return ret;
}
work only
beanBean = (beanRemote)ctx.lookup("beanBeanRemote");
other variants do not work
beanBean = (beanRemote)ctx.lookup("java:comp/env/SomeID");//where SomeID is
described in geronimo-web.xml (looking at example on page
http://cwiki.apache.org/GMOxDOC12/geronimo-webxml.html#geronimo-web.xml-2.4.1EJBreferenceexample
)
in geronimo-web.xml:
<ejb-ref>
<ref-name>SomeID</ref-name>
<pattern>
<groupId>com.qwe</groupId>
<artifactId>GW_EJB</artifactId>
<name>beanBean</name>
</pattern>
</ejb-ref>
djencks wrote:
>
> In the future please give complete concise details of how your apps
> are deployed. I'm guessing that you would say that you have two
> geronimo instances running, either on the same machine or separate
> machines, and that your ejb jar is deployed on one of the geronimo
> instances and the war on the other geronimo instance.
>
> In these circumstances I believe you would either need to use corba
> to use the javaee java:comp/env namespace or use the openejb
> proprietary jndi lookup, supplying the appropriate jndi properties
> when you construct the context.
>
> thanks
> david jencks
>
> On Jan 6, 2008, at 4:06 PM, SergZ wrote:
>
>>
>> Hello.
>> My war is not sensitive to geronimo-web.xml
>>
>> in servlet:
>>
>> my_bean = (beanRemote)ctx.lookup("bean123Remote");
>>
>> in geronimo-web.xml:
>> <ejb-ref>
>> <ref-name>bean123Remote</ref-name>
>> <pattern>
>> <groupId>com.qwe</groupId>
>> <artifactId>GW_EJB</artifactId>
>> <name>beanBean</name>
>> </pattern>
>> </ejb-ref>
>>
>> in openejb-jar.xml
>> <enterprise-beans>
>> <session>
>> <ejb-name>beanBean</ejb-name>
>> <jndi-name>ejb/beanRemote</jndi-name>
>> <local-jndi-name>ejb/beanLocale</local-jndi-name>
>> </session>
>> </enterprise-beans>
>>
>> war cannot find the bean.
>> And why is the JNDIname beanBeanRemote instead of BeanRemote.
>>
>> And can you give me a right example?
>> --
>> View this message in context: http://www.nabble.com/Access-to-ejb-
>> from-war-from-different-jvm-tp14655998s134p14655998.html
>> Sent from the Apache Geronimo - Users mailing list archive at
>> Nabble.com.
>>
>
>
>
--
View this message in context:
http://www.nabble.com/Access-to-ejb-from-war-from-different-jvm-tp14655998s134p14662638.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.