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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Spring error deploying REST services on karaf container

Hi,
We have some REST services generated by Talend Studio ESB. If we deploy at the same machine where we develop them, work ok. However, we're developing our services in our DEVELOPMENT environment, and uploading and deploying them at INTEGRATION/TESTING environment. When we launch Karaf (trun.bat) in this environment appears some Java errors and our services are in state FAILED. What is the problem?
We export our services as OSGI for Bundle (.jar), we carry the file to INTEGRATION environment (container/deploy), but Karaf can't build and start them.
The error is:

Exception in thread "SpringOsgiExtenderThread-6" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'service': Invocation of init method failed; nested
exception is org.apache.cxf.service.factory.ServiceConstructionException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
... 14 more
Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 8.115: Cannot assign requested address: bind
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:386)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:179)
at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)
at org.apache.cxf.binding.AbstractBaseBindingFactory.addListener(AbstractBaseBindingFactory.java:95)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:192)
... 21 more
Caused by: java.net.BindException: Cannot assign requested address: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.Server.doStart(Server.java:286)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:375)
... 26 more


And after execute osgi:list:

karaf@trun> list
START LEVEL 100 , List Threshold: 50
ID State Blueprint Spring Level Name
Apache MINA Core (2.0.5)
Apache CXF Compatibility Bundle Jar (2.7.3)
camel-core (2.10.2)
camel-karaf-commands (2.10.5.SNAPSHOT)
camel-spring (2.10.2)
camel-blueprint (2.10.2)
camel-cxf-transport (2.10.2)
camel-cxf (2.10.2)
Commons Pool (1.6.0)
camel-jms (2.10.2)
Apache ServiceMix :: Bundles :: jdom (1.1.0.4)
OPS4J Pax Web - Jsp Support (1.1.4)
Commons JXPath (1.3)
Service Activity Monitoring :: Common (5.2.2)
Service Activity Monitoring :: Agent (5.2.2)
Talend :: ESB :: Job :: API (5.2.2)
Talend :: ESB :: LOCATOR :: AUTH (5.2.2)
Hosts: 186
ZooKeeper Bundle (3.3.6)
Fragments: 185
Service Locator Client for CXF (5.2.2)
Apache ServiceMix :: Bundles :: dom4j (1.6.1.5)
Apache ServiceMix :: Bundles :: jaxen (1.1.1.2)
Talend :: ESB :: Job :: Controller (5.2.2)
Commons Net (3.1.0)
Apache ServiceMix :: Bundles :: jsch (0.1.48.1)
camel-ftp (2.10.2)
Camel Talend Job Component (5.2.2)
Jolokia Agent (1.0.4)
Apache Karaf :: Shell :: Service Wrapper (2.2.9)
WSTestHandMadeWebService (0.1) (1.4)


Cheers
Thanks

Labels (4)
9 Replies
Anonymous
Not applicable
Author

Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 8.115: Cannot assign requested address: bind

Looks like wrong port specified: try 8115 (without dot)
Anonymous
Not applicable
Author

Hi AleXx,
Thanks by your reply. That dot must be a trace's error. If i unarchive my .jar and open the file META-INF\spring\beans.xml:

<SERVER id="service" address="http://101.281.101.195:8115/">
<SERVICEBEANS>
<REF bean="serviceBean"></REF>
</SERVICEBEANS>
<PROVIDERS>
<REF bean="wrongCallHandler"></REF>
<REF bean="jsonProvider"></REF>
<REF bean="dom4jProvider"></REF>

</PROVIDERS>
</SERVER>
Anonymous
Not applicable
Author

Usually "0.0.0.0" used as service host
Anonymous
Not applicable
Author

What do you mean AleXx??
Anonymous
Not applicable
Author

Try following service configuration:
Anonymous
Not applicable
Author

Hi AleXx, thanks by your reply.
Your suggestion works fine on my local machine (importing from testing environment), but when we deploy them on Integration/preproduction, the issue continues 0683p000009MPcz.png
any idea?

Cheers
Anonymous
Not applicable
Author

Looks like the actual port is busy
Anonymous
Not applicable
Author

Hi mtbabel,
It sounds like your original bundles may not be removed or completely updated in those environments. If you haven't, try uninstalling all of the bundles deployed with this solution. So execute a 'list' and then run 'uninstall' against the bundle ID for each bundle belonging to your web service (one or more).
If that doesn't get you out of the weeds, can you share if you're using TOS for ESB or Enterprise ESB? Also, how are you deploying the web service - using a KAR into the deploy/ directory or using Maven, or TAC or file: URI?
Best Regards,
Ben
Anonymous
Not applicable
Author

Hi,
We've solved our issues several weeks ago reinstalling Karaf and re-configuring the REST services.
Thanks,
Cheers