You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sab12in <sa...@yahoo.co.in> on 2014/11/01 02:12:51 UTC

CXF webservice deployment on glassfish

Hi All,

When i am deploying my CXF web service on glass fish i am not able to get
the endpoint that i configured in bean file.

I am not able to understand why glassfish is exposing the service at
following:

listening at address at
http://xyz:8080/camel-example-reportincident-2.14.0/DefaultPayloadProviderSEI

And if i try to access that url i can not get to the wsdl so basically
noting is exposed.

Appreciate if anyone can help.

Below is my bean file:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xsi:schemaLocation="
         http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
         http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
         http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
   
  <import resource="classpath:META-INF/cxf/cxf.xml"/>
  
 <cxf:cxfEndpoint id="reportIncident"
                   address="/webservices/incident"
                   wsdlURL="etc/report_incident.wsdl"
                  
serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"/>
 

 <bean id="ReportIncidentRoutes"
class="org.apache.camel.example.reportincident.ReportIncidentRoutes"/>
  
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <camel:propertyPlaceholder id="properties"
location="classpath:incident.properties"/>
    
    <routeBuilder ref="ReportIncidentRoutes"/>
  </camelContext>

</beans>

Below is my web.xml:

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

  <display-name>My Web Application</display-name>

  
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:camel-config.xml</param-value>
  </context-param>

  
  <listener>
   
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
   
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/webservices/*</url-pattern>
  </servlet-mapping>

</web-app>

The glassfish server log shows following:

Info:   Webservice Endpoint deployed
org.apache.camel.component.cxf.DefaultPayloadProviderSEI
 listening at address at
http://xyz:8080/camel-example-reportincident-2.14.0/DefaultPayloadProviderSEI.
Info:   WebModule[null] ServletContext.log():No Spring
WebApplicationInitializer types detected on classpath
Info:   WebModule[null] ServletContext.log():Initializing Spring root
WebApplicationContext
Info:   2014-10-31 17:12:54,785 [min-listener(6)] INFO  ContextLoader                 
- Root WebApplicationContext: initialization started
Info:   2014-10-31 17:12:55,143 [min-listener(6)] INFO 
XmlWebApplicationContext       - Refreshing Root WebApplicationContext:
startup date [Fri Oct 31 17:12:55 PDT 2014]; root of context hierarchy
Info:   2014-10-31 17:12:55,334 [min-listener(6)] INFO 
XmlBeanDefinitionReader        - Loading XML bean definitions from class
path resource [camel-config.xml]
Info:   2014-10-31 17:12:55,619 [min-listener(6)] INFO 
XmlBeanDefinitionReader        - Loading XML bean definitions from class
path resource [META-INF/cxf/cxf.xml]
Info:   2014-10-31 17:12:57,942 [min-listener(6)] INFO 
XmlWebApplicationContext       - Bean 'cxf' of type [class
org.apache.cxf.bus.spring.SpringBus] is not eligible for getting processed
by all BeanPostProcessors (for example: not eligible for auto-proxying)
Info:   2014-10-31 17:12:57,961 [min-listener(6)] INFO 
DefaultListableBeanFactory     - Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@414683e:
defining beans
[cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,reportIncident,ReportIncidentRoutes,properties,template,consumerTemplate,camel:beanPostProcessor,camel];
root of factory hierarchy
Info:   2014-10-31 17:12:58,692 [min-listener(6)] INFO  SpringCamelContext            
- Apache Camel 2.14.0 (CamelContext: camel) is starting
Info:   2014-10-31 17:12:58,694 [min-listener(6)] INFO 
ManagedManagementStrategy      - JMX is enabled
Info:   2014-10-31 17:12:58,971 [min-listener(6)] INFO  DefaultTypeConverter          
- Loaded 197 type converters
Info:   2014-10-31 17:12:59,377 [min-listener(6)] INFO  SpringCamelContext            
- AllowUseOriginalMessage is enabled. If access to the original message is
not needed, then its recommended to turn this option off as it may improve
performance.
Info:   2014-10-31 17:12:59,377 [min-listener(6)] INFO  SpringCamelContext            
- StreamCaching is not in use. If using streams then its recommended to
enable stream caching. See more details at
http://camel.apache.org/stream-caching.html
Info:   2014-10-31 17:12:59,494 [min-listener(6)] INFO 
ReflectionServiceFactoryBean   - Creating Service
{http://reportincident.example.camel.apache.org}ReportIncidentEndpointService
from WSDL: etc/report_incident.wsdl
Info:   2014-10-31 17:13:01,022 [min-listener(6)] WARN 
stractWSDLBasedEndpointFactory - Could not find endpoint/port for
{http://reportincident.example.camel.apache.org}ReportIncidentEndpointPort
in wsdl. Using
{http://reportincident.example.camel.apache.org}ReportIncidentService.
Info:   2014-10-31 17:13:01,063 [min-listener(6)] INFO  ServerImpl                    
- Setting the server's publish address to be /webservices/incident
Info:   2014-10-31 17:13:01,143 [min-listener(6)] INFO  SpringCamelContext            
- Route: route1 started and consuming from:
Endpoint[cxf://bean:reportIncident]
Info:   2014-10-31 17:13:01,162 [min-listener(6)] INFO  SpringCamelContext            
- Route: route2 started and consuming from:
Endpoint[file://target/subfolder]
Info:   2014-10-31 17:13:01,162 [min-listener(6)] INFO  SpringCamelContext            
- Total 2 routes, of which 2 is started.
Info:   2014-10-31 17:13:01,165 [min-listener(6)] INFO  SpringCamelContext            
- Apache Camel 2.14.0 (CamelContext: camel) started in 2.473 seconds
Info:   2014-10-31 17:13:01,173 [min-listener(6)] INFO  ContextLoader                 
- Root WebApplicationContext: initialization completed in 6387 ms
Info:   Loading application [camel-example-reportincident-2.14.0] at
[/camel-example-reportincident-2.14.0]
Info:   camel-example-reportincident-2.14.0 was successfully deployed in
26,220 milliseconds.







--
View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF webservice deployment on glassfish

Posted by Willem Jiang <wi...@gmail.com>.
It looks CXF doesn’t follow the @PostConstruct instruction[1].

[1]https://docs.oracle.com/javaee/7/api/javax/annotation/PostConstruct.html


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 15, 2014 at 1:41:03 AM, sab12in (sab12in@yahoo.co.in) wrote:
> Hi,
>  
> I have both cxf-rt-transports-http,cxf-rt-transports-http-jetty jar and now
> i get the following exception.
>  
>  
>  
> Exception while deploying the app [camel-example-reportincident-2.14.0] :
> The lifecycle method [finalizeConfig] must not throw a checked exception.
> Related annotation information: annotation
> [@javax.annotation.PostConstruct()] on annotated element [public void
> org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.finalizeConfig()  
> throws java.security.GeneralSecurityException,java.io.IOException] of type  
> [METHOD]. Please see server.log for more details.
> Thanks and Regards,
> Sabyasachi
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5759153.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: CXF webservice deployment on glassfish

Posted by sab12in <sa...@yahoo.co.in>.
Hi,

I have both cxf-rt-transports-http,cxf-rt-transports-http-jetty jar and now
i get the following exception.



Exception while deploying the app [camel-example-reportincident-2.14.0] :
The lifecycle method [finalizeConfig] must not throw a checked exception.
Related annotation information: annotation
[@javax.annotation.PostConstruct()] on annotated element [public void
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.finalizeConfig()
throws java.security.GeneralSecurityException,java.io.IOException] of type
[METHOD]. Please see server.log for more details.
Thanks and Regards,
Sabyasachi



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5759153.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF webservice deployment on glassfish

Posted by Willem Jiang <wi...@gmail.com>.
Yeah, it should be cxf-rt-transports-http, and you need include the cxf-rt-transports-http-jetty there.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 13, 2014 at 5:13:59 AM, sab12in (sab12in@yahoo.co.in) wrote:
> Hi,
>  
> I have cxf-rt-transports-http-3.01.jar in my in my war file WEB-INF.lib.
> I dont have cxf-rt-http.jar, do you mean the same, if no then what is the
> maven depandancy for cxf-rt-http.jar.
>  
> Thanks and Regards,
> Sabyasachi
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5759011.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: CXF webservice deployment on glassfish

Posted by sab12in <sa...@yahoo.co.in>.
Hi,

I have cxf-rt-transports-http-3.01.jar in my in my war file WEB-INF.lib.
I dont have cxf-rt-http.jar, do you mean the same, if no then what is the
maven depandancy for cxf-rt-http.jar.

Thanks and Regards,
Sabyasachi



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5759011.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF webservice deployment on glassfish

Posted by Willem Jiang <wi...@gmail.com>.
Can you check if you put the cxf-rt-http jar into your class path?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 11, 2014 at 5:48:55 AM, sab12in (sab12in@yahoo.co.in) wrote:
> Hi,
> Thanks for your reply. I did as you suggested as below
>  
> > address="http://localhost:8080/webservices/incident"
>  
> serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"  
> wsdlURL="etc/report_incident.wsdl"
> endpointName="ons:ReportIncidentService"
> xmlns:ons="http://reportincident.example.camel.apache.org"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
>  
> But i get the error Caused by: java.io.IOException: Cannot find any
> registered HttpDestinationFactory from the Bus. This was the reason i was
> not using complete qualified URL in the address.
>  
> Thanks,
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5758863.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: CXF webservice deployment on glassfish

Posted by sab12in <sa...@yahoo.co.in>.
Hi,
Thanks for your reply. I did as you suggested as below

 <cxf:cxfEndpoint id="reportIncident"
                   address="http://localhost:8080/webservices/incident"
                  
serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                   wsdlURL="etc/report_incident.wsdl"
                   endpointName="ons:ReportIncidentService"
xmlns:ons="http://reportincident.example.camel.apache.org"
                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>

But i get the error Caused by: java.io.IOException: Cannot find any
registered HttpDestinationFactory from the Bus. This was the reason i was
not using complete qualified URL in the address.

Thanks,



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5758863.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF webservice deployment on glassfish

Posted by contactreji <co...@gmail.com>.
Hi 

Try to configure your end point this way provided you are following a
contract-first approach.

<cxf:cxfEndpoint id="CONSUMERENDPOINT_CXF" 
                address="http://hostname:port/webservices/incident"
               
serviceClass="path_to_your_service_class_generated_from_wsdl2java_plugin"
		wsdlURL="wsdl/NameofWSDL.wsdl" serviceName="ons:nameofservice"
		endpointName="ons:portname" xmlns:ons="targetNamespaceOfWsdl"
		xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
	</cxf:cxfEndpoint>


Cheers

Reji



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5758442.html
Sent from the Camel - Users mailing list archive at Nabble.com.