I'm a newbie using Fabric8-1.2.0.Beta4 and trying to deploy REST example application (taken from http://tomee.apache.org/examples-trunk/rest-example/README.html) to Tomee on Fabric8. Including openejb-cxf-rs and tomee-jaxrs don't seem to help.
Only changes made: 1) web.xml Added the following as suggested by http://tomee-openejb.979440.n4.nabble.com/Problem-deploying-REST-Examples-on-Eclipse-td4582815.html:
<servlet>
<servlet-name>ApplicationConfig</servlet-name>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>ApplicationConfig</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ApplicationConfig</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
2) Added fabric8-maven-plugin and distributionManagement to pom.xml to use fabric8:deploy to deploy the war file and create rest-example profile.
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>1.2.0.Beta4</version>
<configuration>
<parentProfiles>containers-tomee hawtio</parentProfiles>
<profile>${fabric8.profile}</profile>
<profileVersion>${fabric8.version}</profileVersion>
<jolokiaUrl>http://${deploy-host}:${deploy-port}/jolokia</jolokiaUrl>
<webContextPath>/rest-example</webContextPath>
</configuration>
</plugin>
<distributionManagement>
<repository>
<id>fabric-maven-proxy</id>
<name>FMC Maven Proxy</name>
<!-- Change to your target host -->
<url>fabric::default::http://admin:${password}@${deploy-host}:${deploy-port}/maven/upload/</url>
</repository>
</distributionManagement>
After which I created a container to start the REST application. Able to see the index.html but always getting 403 or 404 errors when trying to call the WS.
Pls help. Thanks
Had removed the changes in web.xml, downloaded apache-tomee-jaxrs-1.7.1 and configured it to run on this version of tomee, it is able to run without issue.
Would need figure out what's the difference between jaxrs and webprofile version so as to make it work on Fabric8-1.2.0.Beta4
Web.xml after change:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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_2_5.xsd"
metadata-complete="false"
version="2.5">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-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>/*</url-pattern>
</servlet-mapping>
</web-app>
beans.xml after change:
<?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:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="restExampleService" address="/rest-example">
<jaxrs:serviceBeans>
<ref bean="postWS" />
<ref bean="commentWS" />
<ref bean="userWS" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="postWS" class="org.superbiz.rest.service.PostService" />
<bean id="commentWS" class="org.superbiz.rest.service.CommentService" />
<bean id="userWS" class="org.superbiz.rest.service.UserService" />
</beans>
Also added 4 features to my profile in Fabric8: spring-web spring cxf-jaxrs fabric-rest