cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tho huynh ngoc <ngocthob...@gmail.com>
Subject Re: Deploy a remote bundle from a java program without Karaf console
Date Wed, 07 Oct 2015 16:36:25 GMT
Could you please let's me know how to config the secured MBean server ?

Best regards
Tho

2015-10-07 18:30 GMT+02:00 tho huynh ngoc <ngocthobkdn@gmail.com>:

> Hi,
>
> I'm using the Karaf-4.0.0.M2
>
> Tho,
>
>
> 2015-10-07 18:26 GMT+02:00 Jean-Baptiste Onofré <jb@nanthrax.net>:
>
>> Hi,
>>
>> you mean using which Karaf version ?
>>
>> The new versions of Karaf use a secured MBean server.
>>
>> Regards
>> JB
>>
>>
>> On 10/07/2015 06:21 PM, tho huynh ngoc wrote:
>>
>>> Hi,
>>>
>>> I can connect to a remote Karaf version 2.2.11 and install a bundle with
>>> the code above.
>>> However, i can not connect to the remote the newer version of Karaf.
>>>
>>> I think that the error is caused by
>>> ObjectName mbeanName = new
>>> ObjectName("osgi.core:type=framework,version=1.5");
>>>
>>> I have changed the value of Version but it does not work.
>>>
>>> I have studied for 2 days but i can't resolve it.
>>>
>>> Could you please help me?
>>>
>>> Thanks,
>>> Tho,
>>>
>>>
>>> 2015-10-07 11:15 GMT+02:00 tho huynh ngoc <ngocthobkdn@gmail.com>:
>>>
>>> Thank you for your help.
>>>>
>>>> I tried with the code as follows:
>>>>
>>>> public class ConnectToRemoteKaraf {
>>>>
>>>>      public static void main(String[] args) throws Exception {
>>>>           HashMap<String, String[]> environment = new HashMap<String,
>>>> String[]>();
>>>>           String username = "karaf";
>>>>           String password = "karaf";
>>>>           String[] credentials = new String[] { username, password };
>>>>           environment.put("jmx.remote.credentials", credentials);
>>>>           //192.168.56.2 is IP of a host containing remote Karaf
>>>>           JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://
>>>> 192.168.56.2:44444/jndi/rmi://192.168.56.2:1099/karaf-root");
>>>>           JMXConnector jmxc = JMXConnectorFactory.connect(url,
>>>> environment);
>>>>           MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
>>>>
>>>>           ObjectName mbeanName = new
>>>> ObjectName("osgi.core:type=framework,version=1.5");
>>>>           FrameworkMBean osgiFrameworkProxy = JMX.newMBeanProxy(mbsc,
>>>> mbeanName,
>>>>                       FrameworkMBean.class, false);
>>>>
>>>>           osgiFrameworkProxy.startBundle(172); //172 is ID of a bundle
>>>> on a
>>>> remote Karaf Container
>>>>      }
>>>> }
>>>>
>>>> However, i receive a error :
>>>>
>>>> Exception in thread "main"
>>>> java.lang.reflect.UndeclaredThrowableException
>>>>      at com.sun.proxy.$Proxy0.startBundle(Unknown Source)
>>>>      at executor.ConnectToRemoteKaraf.main(ConnectToRemoteKaraf.java:33)
>>>> Caused by: javax.management.InstanceNotFoundException:
>>>> osgi.core:type=framework,version=1.5
>>>>      at
>>>>
>>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
>>>>      at
>>>>
>>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(DefaultMBeanServerInterceptor.java:1444)
>>>>      at
>>>>
>>>> com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(JmxMBeanServer.java:1324)
>>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>      at
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>      at
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>      at java.lang.reflect.Method.invoke(Method.java:606)
>>>>      at
>>>>
>>>> org.apache.karaf.management.boot.KarafMBeanServerBuilder$MBeanInvocationHandler.invoke(KarafMBeanServerBuilder.java:80)
>>>>      at com.sun.proxy.$Proxy0.getClassLoaderFor(Unknown Source)
>>>>      at
>>>>
>>>> javax.management.remote.rmi.RMIConnectionImpl$6.run(RMIConnectionImpl.java:1388)
>>>>      at java.security.AccessController.doPrivileged(Native Method)
>>>>      at
>>>>
>>>> javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor(RMIConnectionImpl.java:1384)
>>>>      at
>>>>
>>>> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:835)
>>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>      at
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>      at
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>      at java.lang.reflect.Method.invoke(Method.java:606)
>>>>      at
>>>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
>>>>      at sun.rmi.transport.Transport$2.run(Transport.java:202)
>>>>      at sun.rmi.transport.Transport$2.run(Transport.java:199)
>>>>      at java.security.AccessController.doPrivileged(Native Method)
>>>>      at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
>>>>      at
>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
>>>>      at
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
>>>>      at
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
>>>>      at
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
>>>>      at
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
>>>>      at java.security.AccessController.doPrivileged(Native Method)
>>>>      at
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
>>>>      at
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>>>      at
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>>>      at java.lang.Thread.run(Thread.java:745)
>>>>      at
>>>>
>>>> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
>>>>      at
>>>>
>>>> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
>>>>      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
>>>>      at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
>>>>      at
>>>> javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown
>>>> Source)
>>>>      at
>>>>
>>>> javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:1022)
>>>>      at
>>>>
>>>> javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:298)
>>>>      ... 2 more
>>>>
>>>>
>>>> Could you please help me ?
>>>>
>>>> Regards,
>>>> Tho,
>>>>
>>>> 2015-10-06 19:39 GMT+02:00 Christian Schneider <chris@die-schneider.net
>>>> >:
>>>>
>>>> You could use the karaf jmx services to install the bundle.
>>>>> If you add jolokia you can also use rest calls for this.
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>> Am 06.10.2015 um 19:23 schrieb tho huynh ngoc:
>>>>>
>>>>> Hi,
>>>>>>
>>>>>> I have two hosts Karaf A and B.
>>>>>>
>>>>>> I would like to create a program Java on B to install a bundle X.jar
>>>>>> (either available in a directory of A or of B) into A without Karaf
>>>>>> console.
>>>>>>
>>>>>> How to program it?
>>>>>>
>>>>>> Thank you for your help
>>>>>>
>>>>>> Tho,
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message