0

Good morning,

I'm looking for help please.I'm only a beginner.

I am using cxf-dosgi from (DOSGi Apache Karaf Feature distribution)

I want to make transparent use of services between two remote machines. So I have a karaf container on each of these two machines.


I tested this example : to start with two containers karaf hosted on the same machine then I changed the configuration to test with two containers hosted on two different remote machines. And it works great !

So I want to do the same thing to export to export my web services. I am using Spring DM. So I do this on the server side :

<osgi:service id="osgi-service" ref="myservice" interface="org.apache.camel.Endpoint"> <osgi:service-properties> <entry key="name" value="service"/> <entry key="service.exported.interfaces" value="*"/> </osgi:service-properties> </osgi:service>

I did the installations like in the tutorial with cxf dosgi version 1.6 But I get this error:

16:25:53,256 | ERROR | pool-21-thread-3 | w.service.RemoteServiceAdminCore  193 | 184 - cxf-dosgi-ri-dsw-cxf - 1.6.0 | failed to create server for interface org.apache.camel.Endpoint
java.lang.NullPointerException
    at java.lang.reflect.Array.newArray(Native Method)[:1.7.0_79]
    at java.lang.reflect.Array.newInstance(Array.java:70)[:1.7.0_79]
    at org.apache.cxf.aegis.type.TypeUtil.getTypeRelatedClass(TypeUtil.java:259)
    at org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:108)
    at org.apache.cxf.aegis.type.AbstractTypeCreator.createType(AbstractTypeCreator.java:402)
    at org.apache.cxf.aegis.type.basic.BeanTypeInfo.getType(BeanTypeInfo.java:192)
    at org.apache.cxf.aegis.type.basic.BeanType.getDependencies(BeanType.java:547)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:394)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.addDependencies(AegisDatabinding.java:399)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(AegisDatabinding.java:371)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(AegisDatabinding.java:283)
    at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:242)
    at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
    at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFromFactory(AbstractPojoConfigurationTypeHandler.java:191)
    at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:119)
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportInterfaces(RemoteServiceAdminCore.java:184)
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:140)
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:59)
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:57)
    at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_79]
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:57)[184:cxf-dosgi-ri-dsw-cxf:1.6.0]
    at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:41)[184:cxf-dosgi-ri-dsw-cxf:1.6.0]
    at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.exportServiceUsingRemoteServiceAdmin(TopologyManagerExport.java:185)[183:cxf-dosgi-ri-topology-manager:1.6.0]
    at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(TopologyManagerExport.java:168)[183:cxf-dosgi-ri-topology-manager:1.6.0]
    at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$3.run(TopologyManagerExport.java:143)[183:cxf-dosgi-ri-topology-manager:1.6.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]

Have you an idea of what is wrong?

OliCho
  • 1
  • 1

1 Answers1

0

Ouch .. what are you doing with 1.4-SNAPSHOT. First it is not a release and second it is quite old.

Another thing that looks suspicious is the service.exported.interfaces=myInterface. It should be a fully qualified java interface name. For the start try service.exported.interfaces=* for it.

You should start with my CXF DOSGi tutorial. The code there should work out of the box. You can then add your changes in the config. So it is easier than to start completely new.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • Thank you for your response Christian, I'll try your cxf dosgi tutorial . Does this example work between two remote machines? About this property: service.exported.interfaces = MyInterface. It is just an example. In fact, i'm using org.apache.camel.Endpoint interface. – OliCho Jul 09 '15 at 09:57
  • I tested the example: to start with two containers karaf hosted on the same machine then I changed the configuration to test with two containers hosted on two different remote machines. And it works great! – OliCho Jul 09 '15 at 14:39
  • I want to just do the same thing to export my web services. I am using Spring DM. So I do this on the server side : – OliCho Jul 09 '15 at 14:42
  • I have performed the installations as in the tutorial with version 1.6 But I get this error: – OliCho Jul 09 '15 at 14:43
  • 16:25:53,256 | ERROR | pool-21-thread-3 | w.service.RemoteServiceAdminCore 193 | 184 - cxf-dosgi-ri-dsw-cxf - 1.6.0 | failed to create server for interface org.apache.camel.Endpoint java.lang.NullPointerException at java.lang.reflect.Array.newArray(Native Method)[:1.7.0_79] at java.lang.reflect.Array.newInstance(Array.java:70)[:1.7.0_79] – OliCho Jul 09 '15 at 14:43
  • I am not sure if a camel Endpoint can be exported as a CXF service. It was never meant to be used over a remote connection. What are you trying to achieve with this? – Christian Schneider Jul 09 '15 at 15:09
  • I want to be able to use a web service deployed on another remote machine. ( I'm using tomcat) This service service will be called in a camel route. – OliCho Jul 09 '15 at 15:17
  • You could solve this by adding a zookeeper entry for your tomcat service. DOSGi can then offer you a client proxy for it. Unfortunately creating the entry would require custom code but it can be done – Christian Schneider Jul 09 '15 at 15:48