I have setup a very simple test application to try RESTeasy on Jboss AS 7.1.
Environment:
jboss-as-7.1.0.Final
eclipse 3.7 with Jboss Tools
maven 3
I followed the steps in the tutorial but did not get the same result. The webapp is deployed correctly and it appears in the admin console but it does not work as intended.
The server invariably tells me 404 Resource not available when I try to access http://localhost:8080/SeamSertalVision/services/test
There are 4 files in the whole project:
pom.xml
web.xml
RestApplication.java
Login.java
the pom.xml has one dependency which resolves fine:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.sertal</groupId>
<artifactId>SertalVision</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SertalVision</name>
<description />
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<resteasy.version>2.3.1.GA</resteasy.version>
</properties>
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<outputDirectory>${basedir}/build/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<!-- Include the JBoss Maven repository so we can access JBoss artifacts -->
<repositories>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
the web.xml is empty:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
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">
<display-name>Sertal Vision</display-name>
</web-app>
the RestApplication.java is empty:
package ch.sertal.vision.server;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
#ApplicationPath("/services")
public class RestApplication extends Application {
}
the Login.java contains just one method for testing:
package ch.sertal.vision.server;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
#Path( "/test" )
public class Login {
#GET
#Produces(MediaType.TEXT_HTML)
public Response login() {
return Response.ok( "logged in" ).build();
}
}
that's the whole thing, as it was described in the tutorial (I believe). The deployment works fine. If I add a welcome-file entry to the web.xml it is displayed.
here is the jboss log after teh application is deployed:
WARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager' or the 'java.util.logging.LogManager' service loader.
11:35:17,819 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
11:35:18,016 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
11:35:18,060 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
11:35:18,721 INFO [org.xnio] XNIO Version 3.0.3.GA
11:35:18,722 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
11:35:18,732 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
11:35:18,743 INFO [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
11:35:18,755 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
11:35:18,758 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
11:35:18,770 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
11:35:18,779 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
11:35:18,780 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
11:35:18,781 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
11:35:18,796 INFO [org.jboss.as.security] (MSC service thread 1-10) JBAS013100: Current PicketBox version=4.0.6.final
11:35:18,803 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
11:35:18,829 INFO [org.jboss.as.connector] (MSC service thread 1-9) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
11:35:18,856 INFO [org.jboss.as.naming] (MSC service thread 1-11) JBAS011802: Starting Naming Service
11:35:18,861 INFO [org.jboss.as.mail.extension] (MSC service thread 1-12) JBAS015400: Bound mail session [java:jboss/mail/Default]
11:35:18,911 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
11:35:18,937 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.1.GA
11:35:19,014 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
11:35:19,288 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-13) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
11:35:19,556 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) JBAS015012: Started FileSystemDeploymentService for directory /Development/jboss-as-7.1.0.Final/standalone/deployments
11:35:19,561 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found SeamSertalVision.war in deployment directory. To trigger deployment create a file called SeamSertalVision.war.dodeploy
11:35:19,574 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on /127.0.0.1:9999
11:35:19,574 INFO [org.jboss.as.remoting] (MSC service thread 1-11) JBAS017100: Listening on /127.0.0.1:4447
11:35:19,664 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 2145ms - Started 134 of 205 services (70 services are passive or on-demand)
11:35:19,676 INFO [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015876: Starting deployment of "SeamSertalVision.war"
11:35:20,028 INFO [org.jboss.web] (MSC service thread 1-13) JBAS018210: Registering web context: /SeamSertalVision
11:35:20,066 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "SeamSertalVision.war"
My question is: how can I verify that my Webservice is being registered? There is no hint to his in the log but no error either. There must be something wrong but I can't see what it is.
I have an application on Tomcat with Jersey and there the log clearly shows which classes perform RESTful services.
thank you for your help.
You will not see if the REST service is registered during startup because the service only starts on-demand, then you will see something like this:
INFO [org.jboss.resteasy.cdi.CdiInjectorFactory] (http--127.0.0.1-8080-1)
Found BeanManager at java:comp/BeanManager
INFO [org.jboss.resteasy.spi.ResteasyDeployment] (http--127.0.0.1-8080-1)
Deploying javax.ws.rs.core.Application:
class my.rest.JaxRsActivator$Proxy$_$$_WeldClientProxy
I don't see a significant error in your configuration, but it's possible that you are missing a WEB-INF/beans.xml?
To get a working example of a JBoss7 with a REST service you can create a new project using the following archetype: org.jboss.spec.archetypes:jboss-javaee6-ear-webapp:7.0.2.CR2
(you have to change the version of all JBoss dependencies from 7.0.2.CR2 to 7.1.0.Final).
Related
i want to deploy cxf-based application on wildfly17. i have not included external cxf library in war i want to use internal cxf of wildfly.?
server.log
2019-08-20 17:59:57,235 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore C:\Users\kumarkun\Downloads\jars\wildfly\wildfly-16.0.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
2019-08-20 17:59:57,261 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\kumarkun\Downloads\jars\wildfly\wildfly-16.0.0.Final\standalone\deployments
2019-08-20 17:59:57,277 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "proj2.war" (runtime-name: "proj2.war")
2019-08-20 17:59:57,962 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
2019-08-20 17:59:58,058 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: EJB subsystem suspension complete
2019-08-20 17:59:58,192 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
2019-08-20 17:59:58,470 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
2019-08-20 17:59:58,658 INFO [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.2.4.Final (Apache CXF 3.2.7)
2019-08-20 17:59:59,641 WARN [org.jboss.as.ee] (MSC service thread 1-7) WFLYEE0007: Not installing optional component org.apache.cxf.transport.servlet.CXFServlet due to an exception (enable DEBUG log level to see the cause)
2019-08-20 17:59:59,805 WARN [org.jboss.as.ee] (MSC service thread 1-7) WFLYEE0007: Not installing optional component org.springframework.web.context.ContextLoaderListener due to an exception (enable DEBUG log level to see the cause)
2019-08-20 18:00:00,144 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.8.Final
2019-08-20 18:00:00,191 INFO [org.jboss.ws.cxf.metadata] (MSC service thread 1-7) JBWS024061: Adding service endpoint metadata: id=com.services.Addition
address=http://localhost:8080/proj2/AdditionService
implementor=com.services.Addition
serviceName={http://services.com/}AdditionService
portName={http://services.com/}AdditionPort
annotationWsdlLocation=null
wsdlLocationOverride=null
mtomEnabled=false
2019-08-20 18:00:00,230 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."proj2.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."proj2.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "proj2.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:183)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1738)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1700)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.wsf.spi.WSFException: WFLYWS0066: Servlet class org.apache.cxf.transport.servlet.CXFServlet declared in web.xml; either provide a proper deployment relying on JBossWS or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled.
at org.jboss.as.webservices.tomcat.WebMetaDataModifier.configureEndpoints(WebMetaDataModifier.java:98)
at org.jboss.as.webservices.tomcat.WebMetaDataModifier.modify(WebMetaDataModifier.java:63)
at org.jboss.as.webservices.tomcat.WebMetaDataModifyingDeploymentAspect.start(WebMetaDataModifyingDeploymentAspect.java:40)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:176)
... 8 more
2019-08-20 18:00:00,739 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 74) WFLYCLINF0002: Started client-mappings cache from ejb container
2019-08-20 18:00:00,939 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "proj2.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"proj2.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"proj2.war\"
Caused by: org.jboss.wsf.spi.WSFException: WFLYWS0066: Servlet class org.apache.cxf.transport.servlet.CXFServlet declared in web.xml; either provide a proper deployment relying on JBossWS or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled."}}
2019-08-20 18:00:00,970 INFO [org.jboss.as.server] (ServerService Thread Pool -- 43) WFLYSRV0010: Deployed "proj2.war" (runtime-name : "proj2.war")
2019-08-20 18:00:00,973 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."proj2.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "proj2.war"
2019-08-20 18:00:01,153 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
2019-08-20 18:00:01,157 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
2019-08-20 18:00:01,157 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
2019-08-20 18:00:01,158 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) started (with errors) in 11390ms - Started 371 of 561 services (1 services failed or missing dependencies, 326 services are lazy, passive or on-demand)
i tried to few solution:
1) comment out:-
standalone.xml
<extension module="org.jboss.as.webservices"/>
<subsystem xmlns="urn:jboss:domain:webservices:2.0" statistics-enabled="${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}}">
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
2)
adding dependencies in MAINFIST.MF
Dependencies: org.apache.cxf services
Addition.java :-
#WebService(targetNamespace = "http://services.com/", portName = "AdditionPort", serviceName = "AdditionService")
public class Addition {
#WebMethod(operationName = "func1", action = "urn:Func1")
public int func1(#WebParam(name = "arg0") int x, #WebParam(name = "arg1") int y) {
return x+y;
}
}
web.xml :-
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>proj1</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description>Apache CXF Endpoint</description>
<display-name>cxf</display-name>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/cxf-beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
cxf-bean.xml :-
<?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:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint xmlns:tns="http://services.com/"
id="addition" implementor="com.services.Addition"
wsdlLocation="wsdl/addition.wsdl" endpointName="tns:AdditionPort"
serviceName="tns:AdditionService" address="/AdditionPort">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" scope="singleton" />
</jaxws:features>
</jaxws:endpoint>
</beans>
applicationConext.xml :-
<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder properties-ref="deployProperties"/>
<!-- Activates various annotations to be detected in bean classes -->
<context:annotation-config/>
<!-- Imports SpringMVC configuration -->
<import resource="cxf-beans.xml" />
</beans>
i expect to deploy cxf based applicaion on wildfly server using wildfly internal modules.
I am trying to publish secured SOAP server as a consuming endpoint at JBoss Fuse camel route.
I have the following endpoint and Jetty-security description in my Blueprint configuration:
...
<cxf:cxfEndpoint
xmlns:crm="http://www.bank.com/CRM"
id="crmOutboundService"
address="https://localhost:9001/cxf/CRMOutbound"
serviceName="crm:CRMOutboundRq"
endpointName="crm:ASBOCRMOutPort"
wsdlURL="model/ASBOCRMOut/CRMOutboundRq.wsdl"
serviceClass="com.bank.SAXSourceService">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
</cxf:properties>
</cxf:cxfEndpoint>
<httpj:engine-factory bus="cxf">
<httpj:engine port="9001">
<httpj:tlsServerParameters secureSocketProtocol="TLSv1">
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password"
file="/opt/esb/security/keystore.jks"/>
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore type="JKS" password="password"
file="/opt/esb/security/truststore.jks"/>
</sec:trustManagers>
<sec:cipherSuitesFilter>
<sec:include>.*_WITH_3DES_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:exclude>.*_WITH_NULL_.*</sec:exclude>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
<sec:clientAuthentication want="true" required="true"/>
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
...
Everything as in manual from here: https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.2/pdf/apache_cxf_security_guide/Red_Hat_JBoss_Fuse-6.2-Apache_CXF_Security_Guide-en-US.pdf
I have (among others) the following dependencies in pom.xml:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</dependency>
When application bundle is deployed into JBoss Fuse the following exception comes:
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to load class org.eclipse.jetty.server.Connector from recipe MapRecipe[name='#recipe-11850']"
The questions are: why does such an error take place and what is the right way to establish secured SOAP server in JBoss Fuse?
We have ended up with adding the following directive into Blueprint descriptor:
<bean id="server" class="org.eclipse.jetty.server.Server"/>
The error has gone, and the application is working correctly, but we do not actually understand why, because there are no any references to the new bean. We are trying to figure out, if this directive starts new instance of Jetty server.
I have generated self signed certificate using keytool command. and successfully configured https at jboss fuse level and port assigned to it is 8443. https://localhost:8443/hawtio/login works perfectly fine. In apache cxf i am facing issue. following configuration is done in blueprint xml file.
<cxf:rsServer address="http://0.0.0.0:9192/"
id="serviceOrderEndpoint" serviceClass="pk.com.telenor.so.controller.ServiceOrder"/>
<cxfcore:bus/>
<httpj:engine-factory bus="cxf">
<httpj:engine port="8443">
<httpj:tlsServerParameters secureSocketProtocol="TLSv1">
<sec:keyManagers keyPassword="password">
<sec:keyStore resource="certs/jbossfuse-dev.jks" password="password" type="JKS"/>
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore resource="certs/jbossfuse-dev.jks" password="password" type="JKS"/>
</sec:trustManagers>
<sec:cipherSuitesFilter>
<sec:include>.*_WITH_3DES_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:exclude>.*_WITH_NULL_.*</sec:exclude>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
<sec:clientAuthentication want="true" required="false"/>
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
I want to run it on https://localhost:9192/
In pom.xml file i have placed the following dependencies:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.3.0.M0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-transports-http -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.2.3</version>
</dependency>
This is the issue that i am facing
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxb.JAXBDataBinding not found by org.apache.cxf.cxf-rt-wsdl
When you said "configured https at jboss fuse level " I believe you mean you configured in the $JBOSS_FUSE/etc/org.ops4j.pax.web.cfg.
Then as your cxf rs endpoint get deployed into the JBoss FUSE container, the best practice is that this endpoint use the servlet transport managed by this container(the HTTP OSGi service implmented by OPS4J PAXWEB with jetty), so your configuration address for the cxf:rsServer should be relative address like address="/myendpoint", then you can access it from
https://localhost:8443/cxf/myendpoint.
Also, as the https already configured at JBoss FUSE level, you don't need
<httpj:engine-factory bus="cxf">
...
</httpj:engine-factory>
stuff.
Freeman
I am trying to deploy a web service in Tomcat7 using maven.
Below I provide some configuration info:
web.xml
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
...
pom.xml
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/services/userinfo</path>
...
Given the <url-pattern>/services/*</url-pattern> and <path>/services/userinfo</path> configuration, the URL http://localhost:8080/services/userinfo shows 404.
If using instead <url-pattern>/*</url-pattern> everything works as expected (i.e. http://localhost:8080/services/userinfo shows the list of available methods).
The question:
Why /services/* doesn't work in my case?
The path in your tomcat-maven-plugin configuration
<path>/services/userinfo</path>
defines where you are deploying the webapp (the context root). In this case, you are deploying it to
http://localhost:8080/services/userinfo
Check out the webapps directory in your Tomcat installation.
Since you are defining the CXFServlet mapping as /services/*, the CXF service list would show at
http://localhost:8080/services/userinfo/services/
When you re-defined the mapping to /*, it just appeared to work as expected, but that was only because the context root you used and the service listing path you expected were the same.
When using mvn tomcat:run, Maven downloads the Tomcat bundles into the target directory and the plugin starts this Tomcat instance with the web project. This Tomcat instance is not visible in Eclipse's server view.
But I have a local Tomcat 6 installed, can I configure the Tomcat Plugin in a way that it uses this local Tommcat instance (under CATALINA_HOME) instead of installing a new version into the target project?
This is by design. The official doc for tomcat:run says:
When developping a war project, you usually build your war and deploy it to an installed Tomcat instance. This is time and resources consuming and take time to install locally the instance.
The run mojo give you the opportunity to save that by simply running your war inside an embeded Tomcat instance in your Maven build.
So I have to start the installed Tomcat instance in the server view and then the maven plugin is using this server instance for goals other then tomcat:run.
1)upgrade your Tomcat to Tomcat 7,
2)Configure your Tomcat users.xml to include a set of credentials :
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="manager"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="admin"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user password="password" roles="manager-gui, manager-script, manager-jmx, manager-status, manager, admin-gui, admin-script, admin" username="admin"/>
</tomcat-users>
Your Maven .settings.xml:
<server>
<id>local_tomcat</id>
<username>admin</username>
<password>password</password>
</server>
Create a new 'dev' profile with new Tomcat plugin:
<profile>
<id>dev</id>
<build>
<finalName>tjb</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>local_tomcat</server>
<path>/</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>