[ 
https://issues.apache.org/jira/browse/KARAF-6416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Baptiste Onofré resolved KARAF-6416.
-----------------------------------------
    Resolution: Duplicate

> Karaf 4.1.7 - Could not start JMX connector server due to 
> javax.naming.NoInitialContextException
> ------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-6416
>                 URL: https://issues.apache.org/jira/browse/KARAF-6416
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.1.7, 4.2.6
>            Reporter: Anh Tuan Nguyen
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>
> I'm facing this issue intermittently in both Karaf 4.1.7 and latest Karaf 
> 4.2.6.
> {code:java}
> karaf@root()> Exception in thread "JMX Connector Thread 
> [service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root]" 
> java.lang.RuntimeException: Could not start JMX connector server
> at 
> org.apache.karaf.management.ConnectorServerFactory$1.run(ConnectorServerFactory.java:282)
> Caused by: java.io.IOException: Cannot bind to URL 
> [rmi://127.0.0.1:1099/karaf-root]: javax.naming.NoInitialContextException
> at 
> javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:827)
> at 
> javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:432)
> at 
> org.apache.karaf.management.ConnectorServerFactory$1.run(ConnectorServerFactory.java:269)
> Caused by: javax.naming.NoInitialContextException
> at 
> org.apache.aries.jndi.DelegateContext.getDefaultContext(DelegateContext.java:233)
> at 
> org.apache.aries.jndi.DelegateContext.getURLContext(DelegateContext.java:256)
> at org.apache.aries.jndi.DelegateContext.findContext(DelegateContext.java:214)
> at org.apache.aries.jndi.DelegateContext.bind(DelegateContext.java:82)
> at javax.naming.InitialContext.bind(InitialContext.java:425)
> at 
> javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:644)
> at 
> javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:427)
> ... 1 more{code}
>  
> I've traced the code and found something in 
> org.apache.aries.jndi.ContextHelper.getInitialContext(BundleContext, 
> Hashtable<?, ?>) (org.apache.aries.jndi.core-1.0.2)
>  
> {code:java}
> ContextProvider provider = getContextProvider(context, environment);
>  if (provider != null) {
>  return new DelegateContext(context, provider);
>  } else {
>  String contextFactoryClass = (String) 
> environment.get(Context.INITIAL_CONTEXT_FACTORY);
>  if (contextFactoryClass == null) {
>  return new DelegateContext(context, environment);
>  } else {
>  throw new 
> NoInitialContextException(Utils.MESSAGES.getMessage("no.initial.context.factory",
>  contextFactoryClass));
>  }
>  }
> {code}
> there the provider = null and it's creating DelegateContext without initial 
> context.
> The provider should be retrieved from 
> {code:java}
> ServiceReference[] references = AccessController.doPrivileged(new 
> PrivilegedAction<ServiceReference[]>() {
>  public ServiceReference[] run() {
>  return Activator.getInitialContextFactoryServices();
>  }
>  });{code}
> But getInitialContextFactoryServices is returning nothing, maybe the service 
> is not up yet.
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to