Not sure if that helps because there are year when fiddling with these things.
So I think I have managed to setup a jax-rs service without spring
configuration,
The configuration happens in war/web.xml
The trick is to use the CXFNonSpringJaxrsServlet
More info here:
https://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-WithCXFNonSpringJaxrsServlet
Below are parts of my web.xml. In your position I would start from a very
simple HelloWorld ServiceClass and try to
1) Make it run on http hit, reload (service initialization maybe next step)
2) Locate where the logs go. This is always a non obvious step for me. But
after that is downhill...
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>MyCompany Services</display-name>
<!-- <welcome-file-list> <welcome-file>Start.html</welcome-file>
</welcome-file-list> -->
<servlet>
<display-name>MyBiovista RESTful WS</display-name>
<servlet-name>RESTFulCXFServlet</servlet-name>
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
<-- Here you can extend the default servlet if you want for logging or configuration
purpsoses
<init-param>
<param-name>jaxrs.address</param-name>
<param-value>
/v1
</param-value>
</init-param>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>
com.biovista.ws.impl.VizitService,
com.biovista.ws.impl.FaersService,
com.biovista.ws.impl.oauth2.AccessTokenService,
com.biovista.ws.impl.oauth2.AccessTokenValidatorService,
com.biovista.ws.impl.oauth2.AuthorizationCodeGrantService,
com.biovista.ws.impl.oauth2.AuthorizationCodeDataProvider
</param-value>
</init-param>
<init-param>
<param-name>jaxrs.providers</param-name>
<param-value>
com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider,
com.biovista.ws.impl.jaxrs.JacksonJsonParamConverterProvider,
com.biovista.lib.ws.cxf.jaxrs.RestServiceExceptionMapper,
com.biovista.lib.ws.cxf.jaxrs.AcceptWildcardContainerRequestFilter,
com.biovista.ws.impl.oauth2.RequestDispatcherProvider,
com.biovista.ws.impl.oauth2.AuthContainerRequestFilter,
com.biovista.ws.impl.oauth2.OAuthRequestFilter,
org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider
</param-value>
</init-param>
<!-- registers extension mappings -->
<init-param>
<param-name>jaxrs.extensions</param-name>
<param-value>
xml=application/xml
json=application/json
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RESTFulCXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>CharacterSetFilter</filter-name>
<filter-class>com.biovista.lib.servlet.CharacterSetFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CharacterSetFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.biovista.lib.servlet.ConfigServletContextListener</listener-class>
</listener>
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/rest/v1/vizit/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/rest/v1/vizit/*</url-pattern>
<url-pattern>/rest/v1/oauth2/auth/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<servlet>
<display-name>Biovista SOAP WS</display-name>
<servlet-name>SOAPCXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<init-param>
<param-name>config-location</param-name>
<param-value>classpath:server-beans-simple.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SOAPCXFServlet</servlet-name>
<url-pattern>/soap/*</url-pattern>
</servlet-mapping>
</web-app>
On 2/10/22 18:53, Lewis John McGibbney wrote:
Hi Maxim,
Thanks for your response. See inline below
On 2022/02/10 03:11:59 Maxim Solodovnik wrote:
Hello Lewis,
cxf users@ list is very silent :)
Yes I see that!
what issues are you observing?
The real issue I am having is configuration without using Spring. I want to
keep this as simple as possible. Just use JAX-RS + CXF. That's it! I was unable
to find much documentation which indicated how that could be done.
The Nutch REST is currently run from the command line as a standalone service.
I want to remove all that functionality by migrating it to a WAR which can be
deployed into an environment like Tomcat, TomEE, Jetty, etc. so it is more
stable, configurable and scalable.
While migrating our project I find out it is impossible to have "xml-free"
CXF :) (it was long time ago)
So we still have "cxf-servlet.xml" in our source tree: [1]
and it is referenced in web.xml [2]
everything seems to work as expected
[1]
https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/main/webapp/WEB-INF/classes/cxf-servlet.xml
[2]
https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/main/webapp/WEB-INF/web.xml
Thank you for these resources I will study them and try and implementation over
the weekend. I'll write back here with my finding.
lewismc
--
__________________________________
Vassilis Virvilis Ph.D.
Head of IT
Biovista Inc.
Stay tuned
www: http://www.biovista.com
LinkedIn: https://www.linkedin.com/company/biovista
Twitter: https://twitter.com/BiovistaInc/
Vizit https://twitter.com/BiovistaVizit/
Facebook: https://www.facebook.com/biovistainc
Vizit (research): https://www.facebook.com/BiovistaVizit
YouTube: https://www.youtube.com/user/BiovistaInc
--
US Offices
2421 Ivy Road
Charlottesville, VA 22903
USA
T: +1.434.971.1141
F: +1.434.971.1144
European Offices
34 Rodopoleos Street
Ellinikon, Athens 16777
GREECE
T: +30.210.9629848
F: +30.210.9647606
Biovista is a privately held biotechnology company that finds novel uses for
existing drugs, and profiles their side effects using their mechanism of
action. Biovista develops its own pipeline of drugs in CNS, oncology,
auto-immune and rare diseases. Biovista is collaborating with biopharmaceutical
companies on indication expansion and de-risking of their portfolios and with
the FDA on adverse event prediction.