on 05-13-2008 9:43 PM
Hello everybody,
I am working with the CE 7.1 and I am trying to deploy a session Bean with an aberrant JNDI-Name. The Bean is named JCoListenerBean but a client is looking for this Bean via JNDI-lookup using the name IDOC_INBOUND_ASYNCHRONOUS. That is why I have to change the JNDI-Name of the JCoListenerBean to IDOC_INBOUND_ASYNCHRONOUS. I have tried to do this by using annotations and by adjusting the deployment descriptor (ejb-j2ee-engine.xml). Both ways do not have the designated result.
This is my ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8" ?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd">
<enterprise-beans>
<enterprise-bean>
<ejb-name>JCoListenerBean</ejb-name>
<server-component-ref>
<name>IDOC_INBOUND_ASYNCHRONOUS</name>
<jndi-name>IDOC_INBOUND_ASYNCHRONOUS</jndi-name>
</server-component-ref>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
Anyone knows how to change the JNDI-Name of a session Bean using NetWeaver and the NW Developer Studio. Ideal would be a link to a code example.
Thanks, Stefan
Hi.
I have my ejb-jar like this:
<ejb-jar
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="ejb-jar_ID"
version="2.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">;
<display-name>MyBeanImplementation</display-name>
<icon/>
<enterprise-beans>
<session>
<icon/>
<ejb-name>MyBean</ejb-name>
<local-home>com.me.MyBeanLocalHome</local-home>
<local>com.me.MyBeanLocal</local>
<ejb-class>com.me.MyBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
the ejb-j2ee-engine.xml looks like this.
<ejb-j2ee-engine
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">
<enterprise-beans>
<enterprise-bean>
<ejb-name>MyBean</ejb-name>
<session-props>
<property>
<property-name>InitialSize</property-name>
<property-value>1</property-value>
</property>
<property>
<property-name>MaxSize</property-name>
<property-value>1</property-value>
</property>
<property>
<property-name>ResizeStep</property-name>
<property-value>1</property-value>
</property>
</session-props>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
And then it can be accessed in code like this:
Context context = new InitialContext();
String EJB_LOC = "java:comp/env/ejb/MyBean";
MyBeanLocalHome beanLocalHome = (MyBeanLocalHome)PortableRemoteObject.narrow(context.lookup(EJB_LOC),MyBeanLocalHome.class);
Hope this helps.
Andrew
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrew, thanks for your answer.
I think you have implemented a Bean called MyBean which is locaetd in the package com.me. If you are searching for this Bean, you use the lookup-String "java:comp/env/ejb/MyBean". Isn't it?
My problem is, that I have to find my JCoListenerBean with the lookup-String "IDOC_INBOUND_ASYNCHRONOUS".
Do you have any idea how to modify a Bean (your MyBean) that they could be found with my lookup-String ("IDOC_INBOUND_ASYNCHRONOUS")?
Thanks
Stefan
I would imagine that you should be able to use JNDI to put a reference to the bean in the context to look up.
Im guessing here, but i think you should be able to use the bind() method on the initialContext to place a reference to an object (in our case the bean), with your custom name...
I dont know that much about putting stuff into the jndi unfortunately, just getting stuff out.
I would try putting it in the constructor method, or ejbCreate..
Regards,
Andrew
Edited by: Andrew Morton on May 15, 2008 3:17 PM
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.