I try to rebind a java class called SomeProcess to the JNDI. This binding happens inside a singleton bean called ResourceBinder.
InitialContext ctx = new InitialContext();
ctx.rebind("SomeProcess", new SomeProcess());
log.info(">>>>> SomeProcess bound");
Later, this class is injected inside other ejb called SomeServiceBean.
@Inject
private SomeProcess process;
However, I am getting this error:
org.jboss.naming.remote.protocol.NamingIOException: Failed to rebind [Root exception is java.io.IOException: java.lang.ClassNotFoundException: de.brockhaus.userMgmt.control.process.SomeProcess from [Module "org.jboss.remote-naming:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: C:\Program Files\jboss\wildfly\modules,C:\Program Files\jboss\wildfly\modules\system\layers\base))]] at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:49) 2015-12-28 20:33:02,302 DEBUG [main] de.brockhaus.userMgmt.util.jndi.BeanLocator: Looking up for: /BRO130_3_7_ResourceBinder-solution/SomeServiceBean!de.brockhaus.userMgmt.boundary.SomeService at org.jboss.naming.remote.protocol.v1.Protocol$3.execute(Protocol.java:306) at org.jboss.naming.remote.protocol.v1.Protocol$3.execute(Protocol.java:265) at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.rebind(RemoteNamingStoreV1.java:116) at org.jboss.naming.remote.client.HaRemoteNamingStore$3.operation(HaRemoteNamingStore.java:302) at org.jboss.naming.remote.client.HaRemoteNamingStore$3.operation(HaRemoteNamingStore.java:299) at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:137) at org.jboss.naming.remote.client.HaRemoteNamingStore.rebind(HaRemoteNamingStore.java:298) at org.jboss.naming.remote.client.RemoteContext.rebind(RemoteContext.java:163) at org.jboss.naming.remote.client.RemoteContext.rebind(RemoteContext.java:170) at javax.naming.InitialContext.rebind(InitialContext.java:433) at de.brockhaus.userMgmt.boundary.ResourceBinder.bindResources(ResourceBinder.java:32) at de.brockhaus.userMgmt.boundary.SomeServiceTest.bindResources(SomeServiceTest.java:21) at de.brockhaus.userMgmt.boundary.SomeServiceTest.main(SomeServiceTest.java:13) Caused by: java.io.IOException: java.lang.ClassNotFoundException: de.brockhaus.userMgmt.control.process.SomeProcess from [Module "org.jboss.remote-naming:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: C:\Program Files\jboss\wildfly\modules,C:\Program Files\jboss\wildfly\modules\system\layers\base))] at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:329) at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: de.brockhaus.userMgmt.control.process.SomeProcess from [Module "org.jboss.remote-naming:main" from local module loader @ed17bee (finder: local module finder @2a33fae0 (roots: C:\Program Files\jboss\wildfly\modules,C:\Program Files\jboss\wildfly\modules\system\layers\base))] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:131) at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:112) at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:948) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1255) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41) at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:327) ... 4 more
In order to solve it, I have created a wilfly module de.brockhaus.userMgmt where I have put the maven build jar. This is the module.xml content
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="BRO130_3_7_ResourceBinder-solution.jar"/>
</resources>
<dependencies>
<module name="org.apache.log4j"/>
</dependencies>
I have modified the module.xml
of the module org.jboss.remote-naming
in WildFly 10 release.
<module xmlns="urn:jboss:module:1.3" name="org.jboss.remote-naming">
<resources>
<resource-root path="jboss-remote-naming-2.0.4.Final.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="org.jboss.ejb-client" optional="true"/>
<module name="org.jboss.remoting"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.marshalling"/>
<module name="org.jboss.marshalling.river"/>
<module name="de.brockhaus.userMgmt"/>
</dependencies>
</module>
But now the problem is different: 13:36:01,016 ERROR
[org.jboss.as.naming] (pool-1-thread-1) WFLYNAM0008: Unexpected internal error: java.lang.UnsupportedOperationException: WFLYNAM0043: Naming context is read-only at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:161) at org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(WritableServiceBasedNamingStore.java:109) at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:301) at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:335) at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
13:36:01,459 ERROR [org.jboss.as.naming] (pool-1-thread-2) WFLYNAM0008: Unexpected internal error: java.lang.UnsupportedOperationException: WFLYNAM0043: Naming context is read-only at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:161) at org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(WritableServiceBasedNamingStore.java:109) at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:301) at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:335) at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
13:36:01,590 INFO [org.jboss.ejb.client] (pool-1-thread-3) JBoss EJB Client version 2.1.3.Final 13:36:01,918 ERROR [stderr] (EJB default - 1) log4j:WARN No appenders could be found for logger (de.brockhaus.userMgmt.control.activity.StepOne).
13:36:01,920 ERROR [stderr] (EJB default - 1) log4j:WARN Please initialize the log4j system properly.
13:36:01,921 ERROR [stderr] (EJB default - 1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
new
. The container creates them for you. IsSomeProcess
really an EJB? – Steve CSomeProcess
is only a java class. – julianfperezSomeProcess
instance between applications? – Steve C