-
1. Re: jndi issue: Naming context is read-only
andey Jun 6, 2018 9:13 AM (in response to wuweibear)You can try to add system property com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager set to true to your JBoss EAP configuration file (standalone-*.xml/domain.xml)
<system-properties>
<property name="com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager" value="true" />
</system-properties>
-
2. Re: jndi issue: Naming context is read-only
wuweibear Jun 7, 2018 10:18 AM (in response to andey)Not work. I have added this system properties to my server.
<system-properties> <property name="com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager" value="true"/> </system-properties> What is jersey? Is it included in jboss eap 7? I did not explicitly use it.
thanks
-
3. Re: jndi issue: Naming context is read-only
jewellgm Jun 7, 2018 12:20 PM (in response to wuweibear)Are you trying to create the InitialContext locally on the application server, or from a remote client? If you are doing it locally, you should just be able to instantiate the context without specifying the "java.naming.factory.initial" parameter. If you are doing it remotely, the properties that you showed are outdated. For example, the initial factory class is "org.jboss.naming.remote.client.InitialContextFactory".
-
4. Re: jndi issue: Naming context is read-only
wuweibear Jun 7, 2018 2:29 PM (in response to jewellgm)it is server side. Ok now I understand without specifying the "java.naming.factory.initial" parameter. Do you know how to do jndi binding programmatically instead of the xml descriptor?
I tried the following but not work.
context.bind("java:global/JndiEjb", this);
-
5. Re: jndi issue: Naming context is read-only
jewellgm Jun 7, 2018 3:44 PM (in response to wuweibear)Are you getting the same error, even without the "factory.initial" parameter, or is it something else? Are you using annotations or deployment descriptors to declare your class as an EJB? If you are using annotations, you can use the "mappedName" parameter to force a specific lookup name. Something like:
@Stateless(mappedName="jndiEjb")
-
6. Re: jndi issue: Naming context is read-only
wuweibear Jun 8, 2018 10:42 AM (in response to jewellgm)If I use deployment descriptors, it works. but I just want to confirm that on the server side, in the program, naming context is read only, i.e. method bind() cannot be used (even with java:global)
thanks