cancel
Showing results for 
Search instead for 
Did you mean: 

Is hybris is supporting Apache CXF for creating webservices?Please help

Former Member
0 Kudos

Is hybris is supporting Apache CXF for creating webservices?Please help

0 Kudos

I'm getting this issue: INFO [Thread-1] [HybrisContextFactory] Initializing Spring ApplicationContext took: (15.04 s) error notifying tenant listener : ListableBeanFactory must not be null during server startup. I have followed the same steps mentioned here. Could someone help me with this?

Accepted Solutions (1)

Accepted Solutions (1)

christoph_probst
Active Participant
0 Kudos

Add the apache cxf libs to your project.

Then change the web.xml and integrate the cxf servlet.

     <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>/api/*</url-pattern>
     </servlet-mapping>

Next adapt yourt *-web-spring.xml file as follows

add the name spaces to the beans tag.

 xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs"

And to the xsi:schemaLocation add

 http://cxf.apache.org/jaxws
 http://cxf.apache.org/schemas/jaxws.xsd
 
 http://cxf.apache.org/jaxrs
 http://cxf.apache.org/schemas/jaxrs.xsd

Furthermore import following resources

   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

Now you are ready to define the beans which are used to process soap.

     <bean id="aSoapServiceService" class="your.package.AServiceImplementation" />
     <jaxws:endpoint id="aSoapService" implementor="#aSoapServiceService"
         address="/aSoapService">
         <jaxws:properties>
             <entry
                 key="org.apache.cxf.interceptor.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD"
                 value="TRUE"></entry>
         </jaxws:properties>
     </jaxws:endpoint>

For the service implementation you can use the DSL or as we did generate the classes from a provided WSDL.

To generate the classes from WSDL the buildcallbacks.xml has to be adapted

     <macrodef name="yourext_before_build">
         <sequential>
             <echo message="mkdir gensrc" />
             <mkdir dir="${ext.yourext.path}/gensrc" />
             
 
             <!-- generate WSDL stubs -->
             <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
                 <arg value="-server" />
                 <arg value="-p" />
                 <arg value="your.package" />
                 <arg value="-d" />
                 <arg value="${ext.yourext.path}/gensrc" />
                 <arg value="-frontend"/>
                 <arg value="jaxws21"/>                 
                 <arg value="${ext.yourext.path}/resources/wsdl/webserivce.wsdl" />
                 <classpath>
                     <path refid="cxf.classpath" />
                 </classpath>
             </java>
     </macrodef>





0 Kudos

I'm getting this issue: INFO [Thread-1] [HybrisContextFactory] Initializing <> Spring ApplicationContext took: (15.04 s) error notifying tenant listener : ListableBeanFactory must not be null during server startup. I have followed the same steps mentioned here. Could someone help me with this?

Answers (2)

Answers (2)

0 Kudos

I'm getting this issue: INFO [Thread-1] [HybrisContextFactory] Initializing Spring ApplicationContext took: (15.04 s) error notifying tenant listener : ListableBeanFactory must not be null during server startup. I have followed the same steps mentioned here. Could someone help me with this?

christoph_probst
Active Participant
0 Kudos

Yes you can use cxf for creating webservices with spring (http://cxf.apache.org/docs/writing-a-service-with-spring.html).

When you creating REST webservices you may stick to the approach using springmvc controllers and @ResponseBody annotation as done by hybris in their ycommercewebservices extension (https://wiki.hybris.com/display/release5/ycommercewebservices+Extension+-+Technical+Guide)

Former Member
0 Kudos

Hi Christoph, Thanks for your quick response, but can hybris support java DSL as in case of apache cxf.? also your provided link is not working,i more interested in creating soap web services in hybris. and how we can integrate cxf based rounting in hybris.?

christoph_probst
Active Participant
0 Kudos

I fixed the link. I will give a short overview which files we changed to get a soap webserivce with cxf working in a seperate answer