Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

distributed osgi java first web service

Hello!
We have web service, wich was created using developer guide java first sample.
We need it to be able to handle requests like usual web service. So we implemented distributed osgi lib.
It works fine with talend esb 4.2.1 and later version 5.0.2.
After migrating to version 5.1.1 web service fail to run.
This is console output:
Exception in thread "pool-9-thread-4" java.lang.ExceptionInInitializerError
at org.apache.cxf.frontend.ServerFactoryBean.<init>(ServerFactoryBean.java:94)
at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFactoryBean(AbstractPojoConfigurationTypeHandler.java:77)
at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:119)
at org.apache.cxf.dosgi.dsw.hooks.ServiceHookUtils.createServer(ServiceHookUtils.java:86)
at org.apache.cxf.dosgi.dsw.hooks.CxfPublishHook.createServer(CxfPublishHook.java:106)
at org.apache.cxf.dosgi.dsw.hooks.CxfPublishHook.publishEndpoint(CxfPublishHook.java:80)
at org.apache.cxf.dosgi.dsw.Activator$1.run(Activator.java:164)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: org.apache.cxf.service.factory.Messages != org.apache.cxf.service.factory.SimpleMessages
at java.util.logging.Logger.getLogger(Logger.java:337)
at org.apache.cxf.common.logging.LogUtils.createLogger(LogUtils.java:210)
at org.apache.cxf.common.logging.LogUtils.getL7dLogger(LogUtils.java:152)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.<clinit>(ReflectionServiceFactoryBean.java:143)
... 10 more
I thought version of cxf-dosgi i was using was too old(ver 1.1)
I tried every available version, and got errors like:
Exception in thread "pool-9-thread-1" java.lang.NullPointerException
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.isCreatedByThisRSA(RemoteServiceAdminCore.java:299)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:115)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:72)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:66)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:66)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:38)
at org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:267)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Exception in thread "pool-9-thread-2" java.lang.NullPointerException
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:232)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:72)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:66)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:66)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:38)
at org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:267)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "pool-9-thread-3" java.lang.ExceptionInInitializerError
at org.apache.cxf.frontend.ServerFactoryBean.<init>(ServerFactoryBean.java:85)
at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFactoryBean(AbstractPojoConfigurationTypeHandler.java:80)
at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:114)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:247)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:72)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:66)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:66)
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportSerice(RemoteServiceAdminInstance.java:38)
at org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:267)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: org.apache.cxf.service.factory.Messages != org.apache.cxf.service.factory.SimpleMessages
at java.util.logging.Logger.getLogger(Logger.java:337)
at org.apache.cxf.common.logging.LogUtils.createLogger(LogUtils.java:249)
at org.apache.cxf.common.logging.LogUtils.getL7dLogger(LogUtils.java:191)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.<clinit>(
ReflectionServiceFactoryBean.java:147)
... 13 more

After i got such errors i run command list and see that my service is active but it doesn't work

Commons Configuration (1.6)
Distributed OSGi Distribution Software Single-Bundle Distribution (1.3.1)
ws_customer_portal (1.0)
karaf@trun>
Any advise please.
Labels (3)
5 Replies
Anonymous
Not applicable
Author

Hi,
The cxf version upgraded to 2.6.0 in the 5.1.1 release. could you please add more detailed info or attachment about how the cxf dosgi has been used?
Xilai
Anonymous
Not applicable
Author

Hello!
In previous versions of talend my actions were:
- put cxf-dosgi-ri-singlebundle-distribution-1.1 into deploy folder
- put org.osgi.compendium-1.2.0 into deploy folder
- in my Activator:
public class Activator implements BundleActivator{
private ServiceRegistration registration;
public void start(BundleContext context) throws Exception {
try {
ServiceImpl implementor = new ServiceImpl();
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("osgi.remote.interfaces", "*");
props.put("osgi.remote.configuration.type", "pojo");
props.put("osgi.remote.configuration.pojo.address", "http://localhost:9000/ws_customer_portal");
registration = context.registerService(ServiceImpl.class.getName(), implementor, props);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
throw e; }

To see the whole post, download it here
OriginalPost.pdf
Anonymous
Not applicable
Author

Hi, perhaps this sample (tested back in May on Talend ESB) is something you can leverage: http://www.jroller.com/gmazza/entry/java_first_web_service
HTH,
Glen
Anonymous
Not applicable
Author

Thanks.
It works for me.
One question. Is it possible to change endpoint address or port? As tutorial tells default URL used by Talend ESB is http://localhost:8040/services/doubleit, how can i change it ot http://localhost:9000/doubleit ?
Anonymous
Not applicable
Author

Edit the etc/org.ops4j.pax.web.cfg
org.osgi.service.http.port = 8040