Fuse WS-Trust service ignores protection - cxf

I'm trying to develop a fuse CXF service protected by the WS-Trust "IssuedToken" policy, as explained in the official docs for the Security Token Service.
I did everything as explained in the docs, cross-checking with some of the fuse and CXF official examples.
All seems to be working fine, but when I call the service with SoapUI and no token, instead of receiving an error (because of the missing token) the call goes through and returns the result, as if no protection was implemented at all.
I tried running the same code in "standalone mode" (outside fuse) as done in the CXF "sts" example, and the protection works. Of course in this case I used a different pom file and one more class (Server.java) plus a spring file (wssec-server.xml) to bootstrap the service, but everything else is the same.
So what could be preventing the security setup to work in fuse?
Fuse version: 6.2.1.084 on Ubuntu 14.04.5 LTS
Sources follow. Keep in mind that the whole attempt is a collage from the many examples which I don't fully understand yet, so some instructions might be misplaced here.
pom.xml
<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>rst-abc</groupId>
<artifactId>mock-fuse-service-secure-b</artifactId>
<version>2</version>
<packaging>bundle</packaging>
<name>MockFuseServiceSecureB</name>
<repositories>
<repository>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
<repository>
<id>fusesource.ea</id>
<name>JBoss Community Early Access Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<cxf-version>3.0.4.redhat-621084</cxf-version>
<version.maven-surefire-plugin>2.15</version.maven-surefire-plugin>
<version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin>
<skipTests>true</skipTests>
<!-- the version of the BOM, defining all the dependency versions -->
<fabric.version>1.2.0-SNAPSHOT</fabric.version>
<!-- fabric8 deploy profile configuration -->
<fabric8.profile>quickstarts-cxf-soap</fabric8.profile>
<fabric8.parentProfiles>feature-cxf</fabric8.parentProfiles>
<fabric8.features>fabric-cxf cxf-jaxws</fabric8.features>
<!-- the version of the JBoss Fuse BOM, defining all the dependency versions -->
<jboss.fuse.bom.version>6.2.1.redhat-084</jboss.fuse.bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.fuse.bom</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${jboss.fuse.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<finalName>shared</finalName>
<plugins>
<!-- Skip Test by default and enable them only in Test profile -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven-surefire-plugin}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
javax.jws,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.namespace, javax.xml.ws,
javax.wsdl,
org.osgi.service.blueprint,
io.fabric8.cxf.endpoint,
javax.security.auth.callback,
org.apache.cxf.interceptor.security,
org.apache.cxf.transport.http,
io.fabric8.cxf,
org.apache.cxf, org.apache.cxf.endpoint, org.apache.cxf.frontend, org.apache.cxf.interceptor,
org.apache.cxf.jaxws, org.apache.cxf.message, org.apache.cxf.phase
</Import-Package>
<Import-Service>org.apache.aries.blueprint.NamespaceHandler;
osgi.service.blueprint.namespace=http://cxf.apache.org/transports/http/configuration
</Import-Service>
<Export-Package>it.rst.abc</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.0.4.redhat-621084</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>target/generated/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/hello_world.wsdl</wsdl>
<wsdlLocation>classpath:wsdl/hello_world.wsdl</wsdlLocation>
<frontEnd>jaxws21</frontEnd>
<extraargs>
<extraarg>-impl</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
<additionalJvmArgs>-Djavax.xml.accessExternalSchema=jar:file,file</additionalJvmArgs>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>1.2.0.redhat-621084</version>
</plugin>
</plugins>
</build>
</project>
hello_world.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://abc.rst.it/hello_world"
xmlns:x1="http://abc.rst.it/hello_world/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
xmlns:t="http://docs.oasis-open.org/ws-sx/ws-trust/200512"
xmlns:wsaw="http://www.w3.org/2005/08/addressing"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="HelloWorld"
targetNamespace="http://abc.rst.it/hello_world">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://abc.rst.it/hello_world/types" targetNamespace="http://abc.rst.it/hello_world/types" elementFormDefault="qualified">
<simpleType name="MyStringType">
<restriction base="string">
<maxLength value="30"/>
</restriction>
</simpleType>
<element name="greetMe">
<complexType>
<sequence>
<element name="requestType" type="tns:MyStringType"/>
</sequence>
</complexType>
</element>
<element name="greetMeResponse">
<complexType>
<sequence>
<element name="responseType" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="greetMeRequest">
<wsdl:part element="x1:greetMe" name="in"/>
</wsdl:message>
<wsdl:message name="greetMeResponse">
<wsdl:part element="x1:greetMeResponse" name="out"/>
</wsdl:message>
<wsdl:portType name="Greeter">
<wsdl:operation name="greetMe">
<wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
<wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
<wsp:PolicyReference URI="#AsymmetricSAML2Policy"/>
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="greetMe">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="greetMeRequest">
<soap:body use="literal"/>
<wsp:PolicyReference URI="#Input_Policy"/>
</wsdl:input>
<wsdl:output name="greetMeResponse">
<soap:body use="literal"/>
<wsp:PolicyReference URI="#Output_Policy"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MockSecureService">
<wsdl:port binding="tns:Greeter_SOAPBinding" name="MockPort">
<soap:address location="http://0.0.0.0:9001/cxf/HelloWorldSecure"/>
</wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="AsymmetricSAML2Policy">
<wsp:ExactlyOne>
<wsp:All>
<wsam:Addressing wsp:Optional="false">
<wsp:Policy/>
</wsam:Addressing>
<sp:AsymmetricBinding>
<wsp:Policy>
<sp:InitiatorToken>
<wsp:Policy>
<sp:IssuedToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<sp:RequestSecurityTokenTemplate>
<t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</t:TokenType>
<t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</t:KeyType>
</sp:RequestSecurityTokenTemplate>
<wsp:Policy>
<sp:RequireInternalReference/>
</wsp:Policy>
<sp:Issuer>
<wsaw:Address>http://localhost:8080/SecurityTokenService/
</wsaw:Address>
</sp:Issuer>
</sp:IssuedToken>
</wsp:Policy>
</sp:InitiatorToken>
<sp:RecipientToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token10/>
<sp:RequireIssuerSerialReference/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:RecipientToken>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:AsymmetricBinding>
<sp:Wss11>
<wsp:Policy>
<sp:MustSupportRefIssuerSerial/>
<sp:MustSupportRefThumbprint/>
<sp:MustSupportRefEncryptedKey/>
</wsp:Policy>
</sp:Wss11>
<sp:Trust13>
<wsp:Policy>
<sp:MustSupportIssuedTokens/>
<sp:RequireClientEntropy/>
<sp:RequireServerEntropy/>
</wsp:Policy>
</sp:Trust13>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="Input_Policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="AckRequested" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="SequenceAcknowledgement" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="Sequence" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="CreateSequence" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="Output_Policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="AckRequested" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="SequenceAcknowledgement" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="Sequence" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<sp:Header Name="CreateSequence" Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</wsdl:definitions>
blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd">
<jaxws:endpoint
xmlns:s="http://abc.rst.it/hello_world"
id="server"
implementor="it.rst.abc.GreeterImpl"
endpointName="s:MockPort"
serviceName="s:MockSecureService"
wsdlLocation="classpath:wsdl/hello_world.wsdl"
address="http://0.0.0.0:9001/cxf/HelloWorldSecure">
<jaxws:properties>
<entry key="ws-security.username" value="myservicekey"/>
<entry key="ws-security.password" value="skpass"/>
<entry key="ws-security.signature.properties" value="serviceKeystore.properties"/>
<entry key="ws-security.encryption.properties" value="serviceKeystore.properties"/>
<entry key="ws-security.signature.username" value="myservicekey"/>
</jaxws:properties>
</jaxws:endpoint>
</blueprint>
serviceKeystore.properties
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=sspass
org.apache.ws.security.crypto.merlin.keystore.alias=myservicekey
org.apache.ws.security.crypto.merlin.keystore.file=keys/servicestore.jks
GreeterImpl.java
package it.rst.abc;
import it.rst.abc.hello_world.Greeter;
import java.util.logging.Logger;
#javax.jws.WebService(name = "Greeter", serviceName = "MockSecureService",
targetNamespace = "http://abc.rst.it/hello_world",
wsdlLocation = "classpath:wsdl/hello_world.wsdl")
public class GreeterImpl implements Greeter {
private static final Logger LOG =
Logger.getLogger(GreeterImpl.class.getPackage().getName());
public String greetMe(String me) {
LOG.info("Executing operation greetMe");
System.out.println("Executing operation greetMe");
System.out.println("Message received: " + me + "\n");
return "Hello " + me;
}
}
For the "standalone" example (which works as expected) I used the following (I removed some characters to keep this post within the SO limit):
pom-standalone.xml
<?xml ... ?>
<project xmlns=...>
<modelVersion...
<properties>
<cxf.version>${project.version}</cxf.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/hello_world.wsdl</wsdl>
<frontEnd>jaxws21</frontEnd>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>server</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>demo.wssec.server.Server</mainClass>
<arguments>
<argument>${basedir}/src/main/resources/wssec-server.xml</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.14.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>logkit</artifactId>
<groupId>logkit</groupId>
</exclusion>
<exclusion>
<artifactId>avalon-framework</artifactId>
<groupId>avalon-framework</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
...other log4j dependencies here...
</dependencies>
</project>
Server.java
package demo.wssec.server;
import java.io.File;
import java.net.URL;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
public class Server {
protected Server(URL busURL) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus(busURL.toString());
BusFactory.setDefaultBus(bus);
}
public static void main(String args[]) throws Exception {
URL busURL;
File busFile = new File(args[0]);
if (busFile.exists()) {
busURL = busFile.toURI().toURL();
} else {
busURL = new URL(args[0]);
}
new Server(busURL);
System.out.println("Server ready...");
Thread.sleep(5 * 60 * 1000);
}
}
wssec-server.xml
<?xml ... ?>
<beans xmlns=...>
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<jaxws:endpoint
xmlns:s="http://abc.rst.it/hello_world"
id="server"
implementor="it.rst.abc.GreeterImpl"
endpointName="s:MockPort"
serviceName="s:MockSecureService"
wsdlLocation="classpath:wsdl/hello_world.wsdl"
address="http://0.0.0.0:9001/SoapcxContext/HelloWorldSecure">
<jaxws:properties>
<entry key="ws-security.signature.username" value="myservicekey"/>
<entry key="ws-security.username" value="myservicekey"/>
<entry key="ws-security.password" value="skpass"/>
<entry key="ws-security.signature.properties" value="serviceKeystore.properties"/>
<entry key="ws-security.encryption.properties" value="serviceKeystore.properties"/>
</jaxws:properties>
</jaxws:endpoint>
</beans>
The server is then started with
mvn -f pom-standalone.xml -Pserver
and when I connect with SoapUI I get the following (expected) error:
MessageAddressingHeaderRequired: A required header representing a Message Addressing Property is not present

The code is correct. What is missing is the proper configuration of karaf.
By issuing a
features:list | grep cxf-ws-security
you can check if the feature is installed. To install it, just type
features:install cxf-ws-security
I found the solution in the README.md of the cxf/secure-soap fuse quickstart. The whole fuse cxf security guide doesn't mention it!
Also, it's quite weird that a protected service works unprotected when its protection library is missing, with no messages in the log whatsoever.

Related

Spring Boot Application With React Front End Is Not Displaying Any Pages Pass Home Screen On The Port 8080

This is relatively simple combination of React and Spring, with plenty examples on this and other forums. I am having two profiles: dev and prod. When I build with dev, React is on the Port 3000 and Spring runs on 8080. I am using Okta for authentication and everything works as expected. I can interact with all pages. However, problems start when I build with prod profile. Application starts on port 8080. I get to my home page and I get user authenticated. After that point, I get redirected to my custom error page.
This is really frustrating and my js build is dumping all files to target/classes/public (which what I do expect) and that is also what is in my .jar file when I check it
Here is my App.js. So, nothing besides for the homepage is being served once when we are on the port 8080
class App extends Component {
render() {
return (
<CookiesProvider>
<Router>
<div>
{/* <AppNavbar/> */}
<Switch>
<Route path='/' exact={true} component={Home}/>
<Route path='/alumsum/users' exact={true} component={UserList}/>
<Route path='/alumsum/user/:id' exact={true} component={EditUser}/>
<Route path='/alumsum/onboarding' component={Onboarding}/>
<Route path='/alumsum/onboardingpersonal' exact={true} component={OnboardingPersonal}/>
<Route path='/alumsum/onboardingothers1' exact={true} component={OnboardingOthers1}/>
<Route path='/alumsum/onboardingothers2' exact={true} component={OnboardingOthers2}/>
<Route path='/alumsum/onboardingothers3' exact={true} component={OnboardingOthers3}/>
<Route path='/alumsum/onboardingothers' exact={true} component={OnboardingOthersFullNine} />
<Route path='/alumsum/onboardingloans' exact={true} component={OnboardingLoans}/>
<Route path='/alumsum/plaid' exact={true} component={Plaid}/>
<Route path='/alumsum/privacypolicy' exact={true} component={PrivacyPolicy}/>
<Route path='/alumsum/termsofuse' exact={true} component={TermsOfUse}/>
<Route path='/alumsum/dashboard' exact={true} component={MainContent}/>
<Route path='/alumsum/dashboard/refinance' exact={true} component={Refinance} />
<Route path='/alumsum/dashboard/payment' exact={true} component={Payment} />
</Switch>
<FooterBar/>
</div>
</Router>
</CookiesProvider>
)
}
Now, if there is a question about the POM files, here they are:
<properties>
<java.version>1.8</java.version>
<frontend-maven-plugin.version>1.11.0</frontend-maven-plugin.version>
<node.version>v15.12.0</node.version>
<npm.version>7.6.3</npm.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.kosprov.jargon2</groupId>
<artifactId>jargon2-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.kosprov.jargon2</groupId>
<artifactId>jargon2-native-ri-backend</artifactId>
<version>1.1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.plaid</groupId>
<artifactId>plaid-java</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.15</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>react-router-dom</artifactId>
<version>5.1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>js</workingDirectory>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/classes/public">
<fileset dir="${project.basedir}/js/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
</profiles>
The answer is in adding an extra controller:
#Controller
class PageController {
#GetMapping("/**/{path:[^\\.]*}")
fun forward(request: HttpServletRequest): String? {
if(request.requestURI.startsWith("/admin")) {
return "forward:/admin/index.html"
}
return "forward:/index.html"
}
}
Which happens to be the answer to the question
Configure Spring Boot For SPA frontend

Passing count to SQL query of XML content, NULL response but hard coding fetches the value

I am querying XML content in a table on SQL Server 2014 Service Pack 2 GDR. I can count the desired nodes, and select a specific node but I must dynamically collect the desired node values. Please redirect me to the right syntax and/or method for this.
Instead of the eight values I was expecting from the count, I only get that #loops value printed.
Below is the basic code:
DECLARE #x XML
SET #x =
'<ArrayOfOrderedRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans">
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>f1e00f33-0451-4b25-b69a-6c5f6e358fa6</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>7b901b61-5c7b-4429-a306-d42f7b367e14</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3989</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>1</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>e4eedaf1-3a7e-4bb5-824c-84efebcab2dd</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>1df4b869-5ec8-4582-91f6-28c174aa99ed</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3988</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>2</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<NodeID>f30cd65e-5919-44a5-9977-6e04db9a738b</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3991</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>3</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>1df52ab3-ea2f-45e8-af34-f651625cd1ca</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>124</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>4d1224ee-998d-48e9-8c9c-a74762d0c944</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3994</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>4</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>fee1da03-f490-423d-bdcc-aa7195d560a0</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>6c4209fe-9d8c-48fd-8f9f-6a38299ac368</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4846</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>5</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>41ccb2b1-0e6c-4a54-b1bd-ab22152cdd6b</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>218da0c7-fdd1-4e20-a62b-feba25a28095</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4844</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>6</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>f86419eb-177f-4e3f-bdc2-6d8fd1e3f123</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>d588e812-1607-49a7-b1af-20c3c998a8a6</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4538</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>7</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>dd71e9bb-4d92-47a1-b325-e2e0ed6b7405</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>3e125708-28ba-4629-b096-d565030cb5c2</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4277</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>8</Sequence>
</OrderedRequest>
</ArrayOfOrderedRequest>'
DECLARE #loops INT
-- Total count of <ID> Nodes -- in this case calling the variable loops
SELECT RPL.ResourceXML.value('declare namespace ns="http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans";
count(/ns:ArrayOfOrderedRequest/ns:OrderedRequest/ns:Request/ns:Resource/ns:ID)', 'int') as loops
from
NwsAegisCAD.Response.ResponsePlan as RPL
where RPL.ResponsePlanID =226;
DECLARE #i INT
-- Set counter variable to 1
SET #i = 1
-- loop starts
WHILE #i <= #loops
BEGIN
-- variable to store UNIT ID
DECLARE #UnitID INT
--select unitid to the variable
Select
#UnitID= #x.value('ID[1]', 'INT')
FROM #x.nodes('/ArrayOfOrderedRequest/OrderedRequest/Request/Resource/ID[position()=sql:variable("#i")]')
e(x)
-- increment counter
SET #i = #i + 1
PRINT #UnitID
END
If I want a specific node, or the values encased in their xml tags, then this query works I have been wildly unsuccessful in getting the #i parameter passed to the xml.value query
Select RPL.Name as PlanName,
RPL.ResourceXML.value('declare namespace ns="http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans";
count(/ns:ArrayOfOrderedRequest/ns:OrderedRequest/ns:Request/ns:Resource/ns:ID)', 'int') as COUNT_unitIDs,
RPL.ResourceXML.query('declare namespace ns=
"http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans";
for $unitID in
/ns:ArrayOfOrderedRequest/ns:OrderedRequest/ns:Request/ns:Resource/ns:ID order by $unitID descending return $unitID') as all_the_RPlan_unitIDs ,
RPL.ResourceXML.value('declare namespace ns="http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans";
(/ns:ArrayOfOrderedRequest/ns:OrderedRequest/ns:Request/ns:Resource/ns:ID)[1]', 'int') as first_UnitID
from
NwsAegisCAD.Response.ResponsePlan as RPL
where RPL.ResponsePlanID =226;
.............................................
..............................................
I have read and am re-reading these previously posted inquiries, and both MS articles.
How do I iterate through the Nodes of a XML Field in T-SQL?
sql server xml.value skeleton dynamic cases
Pass the Count(*) to variable via T-SQL
XQUERY - How to use the sql:variable in 'value()' function?
https://learn.microsoft.com/en-us/sql/t-sql/xml/value-method-xml-data-type?view=sql-server-2017
https://learn.microsoft.com/en-us/sql/xquery/xquery-extension-functions-sql-variable?view=sql-server-2017
Thank you for your time and any hints you might share on how to solve this.
For your next question: Please reduce sample data to den needed minimum. If there ist more than 1, then 2 is enough...
You did not state the expected output, but the following will return each and everything. I had to make some asumptions about 1:n and 1:1 related data. So this might need some modifications.
No need for a loop for sure (avoid loops if ever possible!).
If you want to pick a special <Request> you can place a predicate within .nodes():
DECLARE #x XML
SET #x =
N'<ArrayOfOrderedRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans">
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>f1e00f33-0451-4b25-b69a-6c5f6e358fa6</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>7b901b61-5c7b-4429-a306-d42f7b367e14</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3989</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>1</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>e4eedaf1-3a7e-4bb5-824c-84efebcab2dd</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>1df4b869-5ec8-4582-91f6-28c174aa99ed</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3988</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>2</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<NodeID>f30cd65e-5919-44a5-9977-6e04db9a738b</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3991</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>3</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>1df52ab3-ea2f-45e8-af34-f651625cd1ca</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>124</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>4d1224ee-998d-48e9-8c9c-a74762d0c944</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>3994</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>4</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>fee1da03-f490-423d-bdcc-aa7195d560a0</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>6c4209fe-9d8c-48fd-8f9f-6a38299ac368</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4846</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>5</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>41ccb2b1-0e6c-4a54-b1bd-ab22152cdd6b</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>218da0c7-fdd1-4e20-a62b-feba25a28095</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4844</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>6</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>f86419eb-177f-4e3f-bdc2-6d8fd1e3f123</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>160</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>d588e812-1607-49a7-b1af-20c3c998a8a6</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4538</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>7</Sequence>
</OrderedRequest>
<OrderedRequest>
<Request i:type="RequestWithResource">
<BackupList>
<RequestBackup>
<Request i:type="RequestWithResource">
<NodeID>dd71e9bb-4d92-47a1-b325-e2e0ed6b7405</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>164</ID>
<ResourceType>1</ResourceType>
</Resource>
</Request>
<Sequence>0</Sequence>
</RequestBackup>
</BackupList>
<NodeID>3e125708-28ba-4629-b096-d565030cb5c2</NodeID>
<Quantity>1</Quantity>
<Action>Dispatch</Action>
<Resource>
<ID>4277</ID>
<ResourceType>2</ResourceType>
</Resource>
</Request>
<Sequence>8</Sequence>
</OrderedRequest>
</ArrayOfOrderedRequest>';
--The query declares the namespaces ahead...
WITH XMLNAMESPACES(DEFAULT 'http://schemas.datacontract.org/2004/07/NewWorld.Aegis.Cad.Common.Broker.Contract.ResponsePlans'
,'http://www.w3.org/2001/XMLSchema-instance' AS i)
SELECT oRq.value(N'(Request/#i:type)[1]',N'nvarchar(max)') AS Request_Type
,oRq.value(N'(Request/NodeID/text())[1]',N'uniqueidentifier') AS Request_ID
,oRq.value(N'(Request/Quantity/text())[1]',N'int') AS Request_Quantity
,oRq.value(N'(Request/Action/text())[1]',N'nvarchar(max)') AS Request_Action
--Seems to be 1:1, therefore no .nodes() but just a longer XPath
,oRq.value(N'(Request/Resource/ID/text())[1]',N'int') AS Request_Resource_ID
,oRq.value(N'(Request/Resource/ResourceType/text())[1]',N'int') AS Request_Resource_ResourceType
--Sequence is living on the same level as <Request>
,oRq.value(N'(Sequence/text())[1]',N'int') AS Request_Sequence
--Seems to be 1:1 too, the usage of .nodes() is for better readability, a longer XPath was okay as well
,rBkp.value(N'(Request/#i:type)[1]',N'nvarchar(max)') AS Backup_Request_Type
,rBkp.value(N'(Request/NodeID/text())[1]',N'uniqueidentifier') AS Backup_Request_ID
,rBkp.value(N'(Request/Quantity/text())[1]',N'int') AS Backup_Request_Quantity
,rBkp.value(N'(Request/Action/text())[1]',N'nvarchar(max)') AS Backup_Request_Action
FROM #x.nodes(N'/ArrayOfOrderedRequest/OrderedRequest') AS A(oRq) --All OrderRequests
OUTER APPLY oRq.nodes(N'Request/BackupList/RequestBackup') AS B(rBkp); --a BackupList (if it exists)

JBoss-database connectivity losts after 5 mins though procedure was executing in background, results in error

We have 2 environments, where we are calling one procedure from JSP page. I'm getting proper result in one environment after 7 mins as procedure execution time is 7 mins. But in another environment after 5 mins JBoss-database connectivity lost and results in error on JSP.
We are using JBoss EAP domain mode. Kindly provide solution.
Thanks.
Find below domain.xml content :
<?xml version='1.0' encoding='UTF-8'?> <domain xmlns="urn:jboss:domain:1.5"> <extensions> <extension module="org.jboss.as.clustering.infinispan"/> <extension module="org.jboss.as.clustering.jgroups"/> <extension module="org.jboss.as.cmp"/> <extension module="org.jboss.as.configadmin"/> <extension module="org.jboss.as.connector"/> <extension module="org.jboss.as.ee"/> <extension module="org.jboss.as.ejb3"/> <extension module="org.jboss.as.jacorb"/> <extension module="org.jboss.as.jaxr"/> <extension module="org.jboss.as.jaxrs"/> <extension module="org.jboss.as.jdr"/> <extension module="org.jboss.as.jmx"/> <extension module="org.jboss.as.jpa"/> <extension module="org.jboss.as.jsf"/> <extension module="org.jboss.as.jsr77"/> <extension module="org.jboss.as.logging"/> <extension module="org.jboss.as.mail"/> <extension module="org.jboss.as.messaging"/> <extension module="org.jboss.as.modcluster"/> <extension module="org.jboss.as.naming"/> <extension module="org.jboss.as.pojo"/> <extension module="org.jboss.as.remoting"/> <extension module="org.jboss.as.sar"/> <extension module="org.jboss.as.security"/> <extension module="org.jboss.as.threads"/> <extension module="org.jboss.as.transactions"/> <extension module="org.jboss.as.web"/> <extension module="org.jboss.as.webservices"/> <extension module="org.jboss.as.weld"/> </extensions> <system-properties> <property name="java.net.preferIPv4Stack" value="true"/> <property name="jboss.modules.system.pkgs" value="com.singularity"/> </system-properties> <paths> <path name="LOG_PATH" path="E:\Apps\RedHat\Logs\Host01\${jboss.server.name}"/> </paths> <management> <access-control provider="simple"> <role-mapping> <role name="SuperUser"> <include> <user name="$local"/> </include> </role> </role-mapping> </access-control> </management> <profiles> <profile name="full-ha"> <subsystem xmlns="urn:jboss:domain:logging:1.3"> <console-handler name="CONSOLE"> <level name="INFO"/> <formatter> <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> </console-handler> <file-handler name="TransActionLog" autoflush="true"> <level name="DEBUG"/> <file relative-to="LOG_PATH" path="transactions.log"/> <append value="true"/> </file-handler> <size-rotating-file-handler name="FILE" autoflush="true"> <level name="CONFIG"/> <formatter> <pattern-formatter pattern="%d{MM/dd/yyyy HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> <file relative-to="LOG_PATH" path="server.log"/> <rotate-size value="50m"/> <max-backup-index value="30"/> <append value="true"/> </size-rotating-file-handler> <logger category="org.jboss.jca.core.connectionmanager"> <level name="TRACE"/> </logger> <logger category="com.arjuna" use-parent-handlers="false"> <level name="DEBUG"/> <handlers> <handler name="TransActionLog"/> </handlers> </logger> <logger category="org.apache.tomcat.util.modeler"> <level name="WARN"/> </logger> <logger category="org.jboss.as.config"> <level name="TRACE"/> </logger> <logger category="sun.rmi"> <level name="WARN"/> </logger> <logger category="jacorb"> <level name="WARN"/> </logger> <logger category="jacorb.config"> <level name="ERROR"/> </logger> <root-logger> <level name="INFO"/> <handlers> <handler name="CONSOLE"/> <handler name="FILE"/> </handlers> </root-logger> </subsystem> <subsystem xmlns="urn:jboss:domain:cmp:1.1"/> <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/> <subsystem xmlns="urn:jboss:domain:datasources:1.1"> <datasources> <datasource jta="false" jndi-name="java:/omnicab" pool-name="omnicab" enabled="true" use-ccm="false"> <connection-url>jdbc:sqlserver://162.123.118.185:1433;databaseName=omnicab</connection-url> <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class> <driver>sqljdbc4.jar</driver> <pool> <min-pool-size>30</min-pool-size> <max-pool-size>500</max-pool-size> <prefill>true</prefill> <use-strict-min>false</use-strict-min> <flush-strategy>FailingConnectionOnly</flush-strategy> </pool> <security> <user-name>OmniUserMO</user-name> <password>WrUthus4</password> </security> <validation> <validate-on-match>true</validate-on-match> <background-validation>false</background-validation> </validation> <timeout> <blocking-timeout-millis>30000</blocking-timeout-millis> <idle-timeout-minutes>2</idle-timeout-minutes> </timeout> <statement> <share-prepared-statements>false</share-prepared-statements> </statement> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem> <subsystem xmlns="urn:jboss:domain:ee:1.1"> <global-modules> <module name="omnidocs_library" slot="main"/> <module name="org.jboss.remote-naming" slot="main"/> </global-modules> <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement> <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement> </subsystem> <subsystem xmlns="urn:jboss:domain:ejb3:1.4"> <session-bean> <stateless> <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/> </stateless> <stateful default-access-timeout="5000" cache-ref="simple" clustered-cache-ref="clustered"/> <singleton default-access-timeout="5000"/> </session-bean> <mdb> <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:hornetq-ra}"/> <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> </mdb> <pools> <bean-instance-pools> <strict-max-pool name="slsb-strict-max-pool" max-pool-size="100" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/> <strict-max-pool name="mdb-strict-max-pool" max-pool-size="100" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/> </bean-instance-pools> </pools> <caches> <cache name="simple" aliases="NoPassivationCache"/> <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/> <cache name="clustered" passivation-store-ref="infinispan" aliases="StatefulTreeCache"/> </caches> <passivation-stores> <file-passivation-store name="file"/> <cluster-passivation-store name="infinispan" cache-container="ejb"/> </passivation-stores> <async thread-pool-name="default"/> <timer-service thread-pool-name="default"> <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/> </timer-service> <remote connector-ref="remoting-connector" thread-pool-name="default"/> <thread-pools> <thread-pool name="default"> <max-threads count="10"/> <keepalive-time time="100" unit="milliseconds"/> </thread-pool> </thread-pools> <iiop enable-by-default="false" use-qualified-name="false"/> <default-security-domain value="other"/> <default-missing-method-permissions-deny-access value="true"/> </subsystem> <subsystem xmlns="urn:jboss:domain:infinispan:1.4"> <cache-container name="singleton" aliases="cluster ha-partition" default-cache="default"> <transport lock-timeout="60000"/> <replicated-cache name="default" mode="SYNC" batching="true"> <locking isolation="REPEATABLE_READ"/> </replicated-cache> </cache-container> <cache-container name="web" aliases="standard-session-cache" default-cache="repl" module="org.jboss.as.clustering.web.infinispan"> <transport lock-timeout="60000"/> <replicated-cache name="repl" mode="ASYNC" batching="true"> <file-store/> </replicated-cache> <replicated-cache name="sso" mode="SYNC" batching="true"/> <distributed-cache name="dist" l1-lifespan="0" mode="ASYNC" batching="true"> <file-store/> </distributed-cache> </cache-container> <cache-container name="ejb" aliases="sfsb sfsb-cache" default-cache="repl" module="org.jboss.as.clustering.ejb3.infinispan"> <transport lock-timeout="60000"/> <replicated-cache name="repl" mode="ASYNC" batching="true"> <eviction strategy="LRU" max-entries="10000"/> <file-store/> </replicated-cache> <replicated-cache name="remote-connector-client-mappings" mode="SYNC" batching="true"/> <distributed-cache name="dist" l1-lifespan="0" mode="ASYNC" batching="true"> <eviction strategy="LRU" max-entries="10000"/> <file-store/> </distributed-cache> </cache-container> <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4"> <transport lock-timeout="60000"/> <local-cache name="local-query"> <transaction mode="NONE"/> <eviction strategy="LRU" max-entries="10000"/> <expiration max-idle="100000"/> </local-cache> <invalidation-cache name="entity" mode="SYNC"> <transaction mode="NON_XA"/> <eviction strategy="LRU" max-entries="10000"/> <expiration max-idle="100000"/> </invalidation-cache> <replicated-cache name="timestamps" mode="ASYNC"> <transaction mode="NONE"/> <eviction strategy="NONE"/> </replicated-cache> </cache-container> </subsystem> <subsystem xmlns="urn:jboss:domain:jacorb:1.3"> <orb socket-binding="jacorb" ssl-socket-binding="jacorb-ssl"> <initializers security="identity" transactions="spec"/> </orb> </subsystem> <subsystem xmlns="urn:jboss:domain:jaxr:1.1"> <connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory"/> </subsystem> <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/> <subsystem xmlns="urn:jboss:domain:jca:1.1"> <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/> <bean-validation enabled="true"/> <default-workmanager> <short-running-threads> <core-threads count="50"/> <queue-length count="50"/> <max-threads count="50"/> <keepalive-time time="10" unit="seconds"/> </short-running-threads> <long-running-threads> <core-threads count="50"/> <queue-length count="50"/> <max-threads count="50"/> <keepalive-time time="10" unit="seconds"/> </long-running-threads> </default-workmanager> <cached-connection-manager/> </subsystem> <subsystem xmlns="urn:jboss:domain:jdr:1.0"/> <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="udp"> <stack name="udp"> <transport type="UDP" socket-binding="jgroups-udp"/> <protocol type="PING"/> <protocol type="MERGE3"/> <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/> <protocol type="FD"/> <protocol type="VERIFY_SUSPECT"/> <protocol type="pbcast.NAKACK"/> <protocol type="UNICAST2"/> <protocol type="pbcast.STABLE"/> <protocol type="pbcast.GMS"/> <protocol type="UFC"/> <protocol type="MFC"/> <protocol type="FRAG2"/> <protocol type="RSVP"/> </stack> <stack name="tcp"> <transport type="TCP" socket-binding="jgroups-tcp"/> <protocol type="TCPPING" socket-binding="jgroups-tcp"> <property name="initial_hosts"> ${jboss.cluster.tcp.initial_hosts} </property> <property name="timeout"> 2000 </property> </protocol> <protocol type="MERGE2"/> <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/> <protocol type="FD"/> <protocol type="VERIFY_SUSPECT"/> <protocol type="pbcast.NAKACK"/> <protocol type="UNICAST2"/> <protocol type="pbcast.STABLE"/> <protocol type="pbcast.GMS"/> <protocol type="UFC"/> <protocol type="MFC"/> <protocol type="FRAG2"/> <protocol type="RSVP"/> </stack> </subsystem> <subsystem xmlns="urn:jboss:domain:jmx:1.3"> <expose-resolved-model/> <expose-expression-model/> <remoting-connector use-management-endpoint="false"/> </subsystem> <subsystem xmlns="urn:jboss:domain:jpa:1.1"> <jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/> </subsystem> <subsystem xmlns="urn:jboss:domain:jsf:1.0"/> <subsystem xmlns="urn:jboss:domain:jsr77:1.0"/> <subsystem xmlns="urn:jboss:domain:mail:1.1"> <mail-session jndi-name="java:jboss/mail/Default"> <smtp-server outbound-socket-binding-ref="mail-smtp"/> </mail-session> </subsystem> <subsystem xmlns="urn:jboss:domain:messaging:1.4"> <hornetq-server> <persistence-enabled>true</persistence-enabled> <security-enabled>false</security-enabled> <journal-type>NIO</journal-type> <journal-min-files>2</journal-min-files> <connectors> <netty-connector name="netty" socket-binding="messaging"/> <netty-connector name="netty-throughput" socket-binding="messaging-throughput"> <param key="batch-delay" value="50"/> </netty-connector> <in-vm-connector name="in-vm" server-id="0"/> </connectors> <acceptors> <netty-acceptor name="netty" socket-binding="messaging"/> <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput"> <param key="batch-delay" value="50"/> <param key="direct-deliver" value="false"/> </netty-acceptor> <in-vm-acceptor name="in-vm" server-id="0"/> </acceptors> <broadcast-groups> <broadcast-group name="bg-group1"> <jgroups-stack>tcp</jgroups-stack> <broadcast-period>5000</broadcast-period> <connector-ref> netty </connector-ref> </broadcast-group> </broadcast-groups> <discovery-groups> <discovery-group name="dg-group1"> <jgroups-stack>tcp</jgroups-stack> <refresh-timeout>10000</refresh-timeout> </discovery-group> </discovery-groups> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <connector-ref>netty</connector-ref> <discovery-group-ref discovery-group-name="dg-group1"/> </cluster-connection> </cluster-connections> <security-settings> <security-setting match="#"> <permission type="send" roles="guest"/> <permission type="consume" roles="guest"/> <permission type="createNonDurableQueue" roles="guest"/> <permission type="deleteNonDurableQueue" roles="guest"/> </security-setting> </security-settings> <address-settings> <address-setting match="#"> <dead-letter-address>jms.queue.DLQ</dead-letter-address> <expiry-address>jms.queue.ExpiryQueue</expiry-address> <redelivery-delay>0</redelivery-delay> <max-size-bytes>10485760</max-size-bytes> <page-size-bytes>2097152</page-size-bytes> <address-full-policy>PAGE</address-full-policy> <message-counter-history-day-limit>10</message-counter-history-day-limit> <redistribution-delay>1000</redistribution-delay> </address-setting> </address-settings> <jms-connection-factories> <connection-factory name="InVmConnectionFactory"> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/ConnectionFactory"/> </entries> </connection-factory> <connection-factory name="RemoteConnectionFactory"> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/> </entries> <ha>true</ha> <block-on-acknowledge>true</block-on-acknowledge> <retry-interval>1000</retry-interval> <retry-interval-multiplier>1.0</retry-interval-multiplier> <reconnect-attempts>-1</reconnect-attempts> </connection-factory> <pooled-connection-factory name="hornetq-ra"> <transaction mode="xa"/> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/JmsXA"/> </entries> </pooled-connection-factory> </jms-connection-factories> </hornetq-server> </subsystem> <subsystem xmlns="urn:jboss:domain:modcluster:1.1"> <mod-cluster-config advertise-socket="modcluster" connector="ajp"> <dynamic-load-provider> <load-metric type="busyness"/> </dynamic-load-provider> </mod-cluster-config> </subsystem> <subsystem xmlns="urn:jboss:domain:naming:1.4"> <remote-naming/> </subsystem> <subsystem xmlns="urn:jboss:domain:pojo:1.0"/> <subsystem xmlns="urn:jboss:domain:remoting:1.1"> <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/> </subsystem> <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"/> <subsystem xmlns="urn:jboss:domain:sar:1.0"/> <subsystem xmlns="urn:jboss:domain:security:1.2"> <security-domains> <security-domain name="other" cache-type="default"> <authentication> <login-module code="Remoting" flag="optional"> <module-option name="password-stacking" value="useFirstPass"/> </login-module> <login-module code="RealmDirect" flag="required"> <module-option name="password-stacking" value="useFirstPass"/> </login-module> </authentication> </security-domain> <security-domain name="jboss-web-policy" cache-type="default"> <authorization> <policy-module code="Delegating" flag="required"/> </authorization> </security-domain> <security-domain name="jboss-ejb-policy" cache-type="default"> <authorization> <policy-module code="Delegating" flag="required"/> </authorization> </security-domain> </security-domains> </subsystem> <subsystem xmlns="urn:jboss:domain:threads:1.1"/> <subsystem xmlns="urn:jboss:domain:transactions:1.4"> <core-environment> <process-id> <uuid/> </process-id> </core-environment> <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/> <coordinator-environment enable-statistics="true" default-timeout="300"/> </subsystem> <subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" native="false"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server> </subsystem> <subsystem xmlns="urn:jboss:domain:webservices:1.2"> <modify-wsdl-address>true</modify-wsdl-address> <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> <subsystem xmlns="urn:jboss:domain:weld:1.0"/> </profile> </profiles> <interfaces> <interface name="management"/> <interface name="public"/> <interface name="unsecure"/> </interfaces> <socket-binding-groups> <socket-binding-group name="full-ha-sockets" default-interface="public"> <socket-binding name="ajp" port="8009"/> <socket-binding name="http" port="8080"/> <socket-binding name="https" port="8443"/> <socket-binding name="jacorb" interface="unsecure" port="3528"/> <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/> <socket-binding name="jgroups-mping" port="2" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45702"/> <socket-binding name="jgroups-tcp" port="7600"/> <socket-binding name="jgroups-tcp-fd" port="57600"/> <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/> <socket-binding name="jgroups-udp-fd" port="54200"/> <socket-binding name="messaging" port="5445"/> <socket-binding name="messaging-group" port="2" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:29876}"/> <socket-binding name="messaging-throughput" port="5455"/> <socket-binding name="modcluster" port="2" multicast-address="224.0.1.105" multicast-port="23366"/> <socket-binding name="remoting" port="4447"/> <socket-binding name="txn-recovery-environment" port="4712"/> <socket-binding name="txn-status-manager" port="4713"/> <outbound-socket-binding name="mail-smtp"> <remote-destination host="localhost" port="25"/> </outbound-socket-binding> </socket-binding-group> </socket-binding-groups> <deployments> <deployment name="sqljdbc4.jar" runtime-name="sqljdbc4.jar"> <content sha1="ff439c53190a987d327165dec8b148f670cb7ca8"/> </deployment> <deployment name="wfs_ejb.jar" runtime-name="wfs_ejb.jar"> <content sha1="139596c21fbed3524bf304ccfe2a128706d406b4"/> </deployment> <deployment name="wfcustom_ejb.jar" runtime-name="wfcustom_ejb.jar"> <content sha1="00283b69bb89bcc15618e4c5cd28d88504513618"/> </deployment> <deployment name="wfs_timer_ejb.jar" runtime-name="wfs_timer_ejb.jar"> <content sha1="91b3a12fdd4bee9c3cd56e2a7da64e5b0823d7e3"/> </deployment> <deployment name="omnidocs_ejb.jar" runtime-name="omnidocs_ejb.jar"> <content sha1="d1bdbee452de8e84dac6dcdca60aaabb7aa4295a"/> </deployment> <deployment name="webdesktop.war" runtime-name="webdesktop.war"> <content sha1="71dbddf580c087e27232bbe88c7ddff72ce17815"/> </deployment> <deployment name="omnidocs.war" runtime-name="omnidocs.war"> <content sha1="0a59f26d6504fa196cb897d3ea0863ca8e051b44"/> </deployment> <deployment name="ofservices.war" runtime-name="ofservices.war"> <content sha1="1d95260b898c6d673f1776a45d52ff8e3c3ceedf"/> </deployment> <deployment name="customwebapp.war" runtime-name="customwebapp.war"> <content sha1="5089588eae2a6e373d86b307f030401238956d28"/> </deployment> <deployment name="processmanager.war" runtime-name="processmanager.war"> <content sha1="c50a55d7feba6a7ed68ef9bfe5e462a78cf437f9"/> </deployment> <deployment name="omniflowapproval.war" runtime-name="omniflowapproval.war"> <content sha1="ba676ebf2e38f1ca51a59bcc56e1ef83fc8d2572"/> </deployment> <deployment name="processmanager.war_ol" runtime-name="processmanager.war_ol"> <content sha1="301769eac66d03b7eb24271cc7b370b041405c14"/> </deployment> <deployment name="1stview.cab" runtime-name="1stview.cab"> <content sha1="6a47e2a8a73ba77507175721deb0aed08ea711db"/> </deployment> <deployment name="AnnotationToolbar.properties" runtime-name="AnnotationToolbar.properties"> <content sha1="382d32000b2869ee71895b746f4368fc673c559d"/> </deployment> <deployment name="DeleteHotFolder.jsp" runtime-name="DeleteHotFolder.jsp"> <content sha1="1493b777fbc51efe185a5b53ebde1efe5f7e437f"/> </deployment> <deployment name="ExtendSession.jsp" runtime-name="ExtendSession.jsp"> <content sha1="36aae2edb05f96bad955559a4ee1a6b2e47f0dc9"/> </deployment> <deployment name="ForceChangePassword.jsp" runtime-name="ForceChangePassword.jsp"> <content sha1="31c4934ecd9f0001b7abf635feb050c83c6a61f0"/> </deployment> </deployments> <server-groups> <server-group name="OmniFlow_Cluster" profile="full-ha"> <jvm name="omnisrvr_conf"> <heap size="2048m" max-size="2048m"/> <permgen max-size="256m"/> <jvm-options> <option value="-javaagent:E:/Appdynamics/AppServerAgent-SUN/ver4.0.3.0/javaagent.jar"/> <option value="-Dappdynamics.agent.applicationName=OmniFlow"/> <option value="-Dappdynamics.agent.tierName=EBS_Omniflow"/> </jvm-options> </jvm> <socket-binding-group ref="full-ha-sockets"/> <deployments> <deployment name="ofservices.war" runtime-name="ofservices.war"/> <deployment name="omnidocs.war" runtime-name="omnidocs.war"/> <deployment name="omnidocs_ejb.jar" runtime-name="omnidocs_ejb.jar"/> <deployment name="sqljdbc4.jar" runtime-name="sqljdbc4.jar"/> <deployment name="webdesktop.war" runtime-name="webdesktop.war"/> <deployment name="wfcustom_ejb.jar" runtime-name="wfcustom_ejb.jar"/> <deployment name="wfs_ejb.jar" runtime-name="wfs_ejb.jar"/> <deployment name="wfs_timer_ejb.jar" runtime-name="wfs_timer_ejb.jar"/> <deployment name="customwebapp.war" runtime-name="customwebapp.war"/> </deployments> <system-properties> <property name="jboss.cluster.tcp.initial_hosts" value="162.123.228.158[7600],162.123.228.157[7600]" boot-time="true"/> </system-properties> </server-group> <server-group name="Reports_Cluster" profile="full-ha"> <jvm name="omnisrvr_conf"> <heap size="2048m" max-size="2048m"/> <permgen max-size="256m"/> <jvm-options> <option value="-javaagent:E:/Appdynamics/AppServerAgent-SUN/ver4.0.3.0/javaagent.jar"/> <option value="-Dappdynamics.agent.applicationName=OmniFlow"/> <option value="-Dappdynamics.agent.tierName=EBS_Omniflow"/> </jvm-options> </jvm> <socket-binding-group ref="full-ha-sockets"/> <deployments> <deployment name="omnidocs_ejb.jar" runtime-name="omnidocs_ejb.jar"/> <deployment name="sqljdbc4.jar" runtime-name="sqljdbc4.jar"/> <deployment name="wfcustom_ejb.jar" runtime-name="wfcustom_ejb.jar"/> <deployment name="wfs_ejb.jar" runtime-name="wfs_ejb.jar"/> <deployment name="wfs_timer_ejb.jar" runtime-name="wfs_timer_ejb.jar"/> <deployment name="processmanager.war" runtime-name="processmanager.war"/> </deployments> <system-properties> <property name="jboss.cluster.tcp.initial_hosts" value="162.123.228.158[7700],162.123.228.157[7700]" boot-time="true"/> </system-properties> </server-group> </server-groups> </domain>

How to run test classes one by one inside <test> tag using maven

I have below testng xml but its not working. Every time running by maven it strat execution on three browsers. I want to run all classes one by one.
<?xml version="1.0" encoding="UTF-8"?>
<parameter name="browser" value="${browser}" />
<parameter name="execution" value="${execution}" />
<test name="POC Test" preserve-order="true" thread-count="1" >
<classes>
<class name="com.testscript.OurPurposeTest" />
<class name="com.testscript.ContactUsTest" />
<!-- <class name="com.testscript.ChevronTest" /> -->
<class name="com.testscript.SearchTest" />
<class name="com.testscript.FinancialRegulatoryReportsTest" />
<class name="com.testscript.CompanyHistoryTest" />
<class name="com.testscript.HomePageTest" />
</classes>
</test> <!-- POC Test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

Issue invoking WS-Security Enabled service using camel cxf endpoint - No username available

I am trying to invoke a third party .net web service with ws-security and I am getting the following exception in spite of configuring all the required parameters in WSS4JOutInterceptor.
org.apache.cxf.interceptor.Fault: No username available
at org.apache.cxf.ws.security.wss4j.policyhandlers.TransportBindingHandler.handleBinding(TransportBindingHandler.java:177)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessageInternal(PolicyBasedWSS4JOutInterceptor.java:195)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:114)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:101)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[cxf-core-3.0.2.jar:3.0.2]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)[cxf-core-3.0.2.jar:3.0.2]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:416)[cxf-core-3.0.2.jar:3.0.2]
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:112)[camel-cxf-2.14.1.jar:2.14.1]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:166)[camel-core-2.14.1.jar:2.14.1]
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:74)[camel-core-2.14.1.jar:2.14.1]
at java.util.TimerThread.mainLoop(Timer.java:555)[:1.8.0_25]
at java.util.TimerThread.run(Timer.java:505)[:1.8.0_25]
Below is my cxf end point configuration
<cxf:cxfEndpoint id="telapoint"
address="https://mycompany.com/APIv2/MyService" wsdlURL="https://mycompany.com/APIv2/MyServices.svc?wsdl">
<cxf:inInterceptors>
<ref bean="loggingInInterceptor" />
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor" />
<ref bean="wss4jOutInterceptor" />
</cxf:outInterceptors>
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>
</cxf:cxfEndpoint</b>>
<bean id="wss4jOutInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken Timestamp" />
<entry key="passwordType" value="PasswordText" />
<entry key="user" value="xxxxxx" />
<entry key="passwordCallbackClass"
value="com.mycompany.t.UTPasswordCallback" />
<entry key="addUsernameTokenNonce" value="true" />
<entry key="addUsernameTokenCreated" value="true" />
</map>
</constructor-arg>
</bean>
Below is the Camel Route
<camelContext xmlns="http://camel.apache.org/schema/spring"
trace="false">
<route id="telaPoint_Camel_Route_with_CXF">
<from uri="timer://foo?fixedRate=true&period=10m" />
<setBody>
<constant>
<![CDATA[
<v2:OrdersGetByStatus xmlns:v2="http://mycompany.com/TelaFuel/v2">
<v2:status>Delivered</v2:status>
</v2:OrdersGetByStatus>
]]>
</constant>
</setBody>
<setHeader headerName="operationName">
<constant>OrdersGetByStatus</constant>
</setHeader>
<setHeader headerName="operationNamespace">
<constant>http://mycompany.com/TelaFuel/v2</constant>
</setHeader>
<to uri="telapoint" />
</route>
</camelContext>
Below are my POM depedencies
<properties>
<camel-version>2.14.1</camel-version>
<log4j-version>1.2.17</log4j-version>
<jaxb-api-version>2.2.12</jaxb-api-version>
<jaxb-impl-version>2.2.11</jaxb-impl-version>
<cxf-version>3.0.2</cxf-version>
<log4j-version>1.2.17</log4j-version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf-version}</version>
</dependency>
</dependencies>
(below is the snippet of the ws-policy from the wsdl)
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpToken/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy/>
</sp:Wss11>
<sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportIssuedTokens/>
<sp:RequireClientEntropy/>
<sp:RequireServerEntropy/>
</wsp:Policy>
</sp:Trust10>
</wsp:All>
</wsp:ExactlyOne>
As CXF PAYLOAD dataformate doesn't process the soap header, you may need to change the dataformat to CXF_MESSAGE or POJO to force CXF interceptor to handle those soap header.
If I have understood correctly you are trying to create a SOAP client for a Web Services that includes a <wsp:Policy> definition.
This means that you should not include any CXF interceptor (e.g. like WSS4JOutInterceptor). You should just configure a jaws:client appropriately so as to automatically detect the <wsp:Policy> in the WSDL and enable its internal WS Security Policy interceptor. If you define extra ones (as you did) then it will not work at all.
Check out these example:
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Web_Services_Security_Guide/files/STS-Demo-Client.html
and
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Web_Services_Security_Guide/files/STS-Demo-Server.html
An example could be:
<jaxws:client
xmlns:tns="http://www.mynamespace.com/test"
id="testSecureSoapClient"
wsdlLocation="wsdl/should_include_policy__definition.wsdl"
address="http://localhost:8192/test"
endpointName="tns:testServicePort"
serviceName="tns:testServiceService"
serviceClass="com.test.TestServicePortType">
<jaxws:properties>
<entry key="ws-security.callback-handler">
<ref component-id="myTestPasswordCallback"/>
</entry>
...
</jaxws:properties>
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
</jaxws:outInterceptors>
</jaxws:client>

Resources