]
Eduardo Martins commented on AS7-6187:
--------------------------------------
[~kaising] What are you trying to accomplish with this code? Note that you're hacking
Naming internals (WritableServiceBasedNamingStore pushOwner & popOwner), and that may
be the cause for your issues.
NullPointerException during SAR Service deployment
--------------------------------------------------
Key: AS7-6187
URL:
https://issues.jboss.org/browse/AS7-6187
Project: Application Server 7
Issue Type: Bug
Components: Naming
Affects Versions: 7.2.0.Alpha1
Reporter: Guy Kaisin
Assignee: Eduardo Martins
Hi all,
Still continuing to test/verify how to use mbean...
Here is now how I implement the bind/rebind:
<code>
private void rebind() throws NamingException
{
InitialContext rootCtx = new InitialContext();
Name fullName = rootCtx.getNameParser("").parse(getFullJndiName());
ServiceName servName=ServiceName.parse(getFullJndiName());
WritableServiceBasedNamingStore.pushOwner(servName);
try
{
logger.info("fullName=" + fullName+" -> rebind ...");
org.jboss.util.naming.NonSerializableFactory.rebind(fullName, sHelper, true);
logger.info("fullName=" + fullName+" -> rebind ok");
}
catch(NamingException ex)
{ ex.printStackTrace(); throw ex; }
finally
{ WritableServiceBasedNamingStore.popOwner(); }
}
</code>
Like that, I don't have the 'context is read only' issue any more.
But I get another exception...
13:54:54,997 INFO [be.post.common.servicebinder.DaoJndiBinder] (MSC service thread 1-2)
fullName=java:global/mid/be.pos
t.mid.dao.AddressDAO
13:54:55,012 INFO [be.post.common.servicebinder.DaoJndiBinder] (MSC service thread 1-2)
fullName=java:global/mid/be.pos
t.mid.dao.AddressDAO -> rebind ...
13:54:55,013 ERROR [stderr] (MSC service thread 1-2) javax.naming.NamingException: Failed
to bind [Reference Class Name:
be.post.common.servicelocator.helper.ServiceHelper
13:54:55,014 ERROR [stderr] (MSC service thread 1-2) Type: nns
13:54:55,014 ERROR [stderr] (MSC service thread 1-2) Content:
java:global/mid/be.post.mid.dao.AddressDAO
13:54:55,014 ERROR [stderr] (MSC service thread 1-2) ] at location [service
jboss.naming.context.java.global.mid."be.pos
t.mid.dao.AddressDAO"] [Root exception is java.lang.NullPointerException]
13:54:55,015 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.util.NamingUtils.namingException(NamingUt
ils.java:151)
13:54:55,061 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.WritableServiceBasedNamingStore.bind(Writ
ableServiceBasedNamingStore.java:80)
13:54:55,066 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(Wr
itableServiceBasedNamingStore.java:95)
13:54:55,066 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.NamingContext.rebind(NamingContext.java:2
61)
13:54:55,067 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.InitialContext.rebind(InitialContext.java
:158)
13:54:55,067 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.NamingContext.rebind(NamingContext.java:2
69)
13:54:55,067 ERROR [stderr] (MSC service thread 1-2) at
javax.naming.InitialContext.rebind(InitialContext.java:408)
13:54:55,067 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.util.naming.NonSerializableFactory.rebind(NonSerial
izableFactory.java:185)
13:54:55,068 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.util.naming.NonSerializableFactory.rebind(NonSerial
izableFactory.java:250)
13:54:55,068 ERROR [stderr] (MSC service thread 1-2) at
be.post.common.servicebinder.JndiBinder.rebind(JndiBinder.jav
a:72)
13:54:55,068 ERROR [stderr] (MSC service thread 1-2) at
be.post.common.servicebinder.JndiBinder.startService(JndiBind
er.java:52)
13:54:55,069 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(Servi
ceMBeanSupport.java:250)
13:54:55,069 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSuppor
t.java:158)
13:54:55,069 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(Serv
iceMBeanSupport.java:229)
13:54:55,070 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSuppo
rt.java:154)
13:54:55,070 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.system.ServiceMBeanSupport.postRegister(ServiceMBea
nSupport.java:364)
13:54:55,070 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.mbeanserver.MBeanSupport.postRegister(MBeanSuppor
t.java:192)
13:54:55,071 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.postReg
isterInvoke(DefaultMBeanServerInterceptor.java:1035)
13:54:55,071 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registe
rDynamicMBean(DefaultMBeanServerInterceptor.java:974)
13:54:55,071 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registe
rObject(DefaultMBeanServerInterceptor.java:917)
13:54:55,072 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registe
rMBean(DefaultMBeanServerInterceptor.java:312)
13:54:55,072 ERROR [stderr] (MSC service thread 1-2) at
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBean
Server.java:482)
13:54:55,073 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.reg
isterMBean(PluggableMBeanServerImpl.java:551)
13:54:55,073 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(Plugg
ableMBeanServerImpl.java:319)
13:54:55,073 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistra
tionService.java:90)
13:54:55,074 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startSe
rvice(ServiceControllerImpl.java:1811)
13:54:55,074 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(Ser
viceControllerImpl.java:1746)
13:54:55,074 ERROR [stderr] (MSC service thread 1-2) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Thread
PoolExecutor.java:886)
13:54:55,075 ERROR [stderr] (MSC service thread 1-2) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPool
Executor.java:908)
13:54:55,075 ERROR [stderr] (MSC service thread 1-2) at
java.lang.Thread.run(Thread.java:662)
13:54:55,076 ERROR [stderr] (MSC service thread 1-2) Caused by:
java.lang.NullPointerException
13:54:55,076 ERROR [stderr] (MSC service thread 1-2) at
org.jboss.as.naming.WritableServiceBasedNamingStore.bind(Writ
ableServiceBasedNamingStore.java:77)
13:54:55,076 ERROR [stderr] (MSC service thread 1-2) ... 28 more
13:54:55,076 WARN [be.post.common.servicebinder.DaoJndiBinder] (MSC service thread 1-2)
Starting failed mid.services.da
o:service=AddressDAOMBean: javax.naming.NamingException: Failed to bind [Reference Class
Name: be.post.common.serviceloc
ator.helper.ServiceHelper
Type: nns
Content: java:global/mid/be.post.mid.dao.AddressDAO
] at location [service
jboss.naming.context.java.global.mid."be.post.mid.dao.AddressDAO"] [Root
exception is java.lang.N
ullPointerException]
at org.jboss.as.naming.util.NamingUtils.namingException(NamingUtils.java:151)
at
org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:80)
at
org.jboss.as.naming.WritableServiceBasedNamingStore.rebind(WritableServiceBasedNamingStore.java:95)
at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:261)
at org.jboss.as.naming.InitialContext.rebind(InitialContext.java:158)
at org.jboss.as.naming.NamingContext.rebind(NamingContext.java:269)
at javax.naming.InitialContext.rebind(InitialContext.java:408) [rt.jar:1.6.0_25]
at org.jboss.util.naming.NonSerializableFactory.rebind(NonSerializableFactory.java:185)
at org.jboss.util.naming.NonSerializableFactory.rebind(NonSerializableFactory.java:250)
at be.post.common.servicebinder.JndiBinder.rebind(JndiBinder.java:72)
at be.post.common.servicebinder.JndiBinder.startService(JndiBinder.java:52)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:250)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:158)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:229)
at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:154)
at org.jboss.system.ServiceMBeanSupport.postRegister(ServiceMBeanSupport.java:364)
at com.sun.jmx.mbeanserver.MBeanSupport.postRegister(MBeanSupport.java:192)
[rt.jar:1.6.0_25]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.postRegisterInvoke(DefaultMBeanServerInterceptor.java:1
035) [rt.jar:1.6.0_25]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java
:974) [rt.jar:1.6.0_25]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
[rt.jar:1.6.0_25]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
[
rt.jar:1.6.0_25]
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
[rt.jar:1.6.0_25]
at
org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.registerMBean(PluggableMBeanServerImpl.java:551)
[j
boss-as-jmx-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(PluggableMBeanServerImpl.java:319)
[jboss-as-jmx-7.2.
0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistrationService.java:90)
[jboss-as-jmx-7.2.0.Alpha1-
SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-ms
c-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.G
A.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
Caused by: java.lang.NullPointerException
at
org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:77)
... 28 more
13:54:55,087 ERROR [be.post.common.servicebinder.DaoJndiBinder] (MSC service thread 1-2)
javax.naming.NamingException: F
ailed to bind [Reference Class Name: be.post.common.servicelocator.helper.ServiceHelper
Type: nns
Content: java:global/mid/be.post.mid.dao.AddressDAO
] at location [service
jboss.naming.context.java.global.mid."be.post.mid.dao.AddressDAO"] [Root
exception is java.lang.N
ullPointerException]
I use a jboss-service.xml file, containing the following:
<mbean name="mid.services.dao:service=AddressDAOMBean"
code="be.post.common.servicebinder.DaoJndiBinder">
<attribute name="JndiName">be.post.mid.dao.AddressDAO</attribute>
<attribute
name="DataSourceJndiName">java:MIDCoreOracleDS</attribute>
<attribute
name="InterfaceClass">be.post.mid.dao.AddressDAO</attribute>
<attribute
name="ImplementationClass">be.post.mid.dao.oracle.AddressOracle</attribute>
</mbean>
I could identify the line giving the exception:
// add the service name to runtime bindings management service, which on stop releases
the services.
final Set<ServiceName> duBindingReferences = (Set<ServiceName>
getServiceRegistry().getService(JndiNamingDependencyProcessor.serviceName(deploymentUnitServiceName)).getValue();
But what is the root cause of it?
any suggestion?
thanks a lot...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: