HTTP Session Replication in JBoss EAP 6.1 - jboss7.x

I am trying to get my JSF Web Application deployed in a "domain" cluster with two nodes.
I am unable to get the HTTP Session replicated between the nodes.
I have configured my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<session-config>
<session-timeout>30</session-timeout>
<tracking-mode>URL</tracking-mode>
</session-config>
<distributable></distributable>
</web-app>
and jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>thumbzup-admin</context-root>
<!--replication-config>
<replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
</replication-config-->
<replication-config>
<cache-name>custom-session-cache</cache-name>
<replication-trigger>SET</replication-trigger>
<replication-granularity>ATTRIBUTE</replication-granularity>
<!--replication-field-batch-mode>true</replication-field-batch-mode-->
<use-jk>false</use-jk>
<max-unreplicated-interval>30</max-unreplicated-interval>
<snapshot-mode>INSTANT</snapshot-mode>
<snapshot-interval>1000</snapshot-interval>
<replication-mode>SYNCHRONOUS</replication-mode>
<!--session-notification-policy>com.example.CustomSessionNotificationPolicy</session-notification-policy-->
</replication-config>
</jboss-web>
and Infinispan Cache Container in domain.xml;
<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>
But I am unable to retrieve a session created on NODE1 when using the same SESSIONID on NODE2.
Any suggestions?

The name
"custom-session-cache"
you defined in jboss-web.xml does not seem to match any cache inside domain.xml. Remove "cache-name" property completely to use the value of "default-cache" property of the "web" container or add a cache entry with that name

Related

Context-root with JSF 2.3 Web Application on GlassFish 5

I have a hard time trying to configure the context-root for my web application consisting of two artifacts, a Web Archive and an EJB.jar (XYZ_war.war and XYZ_ejb.jar)
I can reach the application without any problems using
localhost/XYZ
(or on the remote server using www.domain.xy/XYZ)
but
with localhost
(or www.domain.xy)
the Glassfish default website from the docroot directory is displayed ('Your server is now runnning ...')
I do the deployment using the GlassFish Web Admin console.
All my searching here or elsewhere didn't help so far.
What am I missing?
Any help would be much appreciated.
Thanks!
glassfish-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish
Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/XYZ</context-root>
</glassfish-web-app>
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>XYZ</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>15</session-timeout>
</session-config>
</web-app>
domain.xml:
<network-listeners>
...
<network-listener protocol="http-listener-1" port="80" name="http-listener-1" thread-pool="http-thread-pool" transport="tcp">
...
</networklistener>
...
<applications>
<application context-root="/XYZ" object-type="user" name="XYZ_war" location="${com.sun.aas.instanceRootURI}/applications/XYZ_war/">
...
</application>
<application object-type="user" name="XYZ_ejb" location="${com.sun.aas.instanceRootURI}/applications/XYZ_ejb/">
...
</application>
</applications>
So if I understand correctly you are setting your context-root to /XYZ and you expect it to be /? How about setting it to /?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish
Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/</context-root>
</glassfish-web-app>
Have fun :)

How to enable SSL/TLS in Jboss fuse REST Service (JAX-RS)?

I have created REST service using JBossFuse JAX-RS, the XML file is as below.
Can anyone help me to enable SSL/TLS to this service?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<jaxrs:server address="http://localhost:9000/employee" id="EmplRestService">
<jaxrs:serviceBeans>
<ref bean="EmplService"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="EmplService" class="com.sample.beans.EmployeeServiceResource"/>
</beans>
Thanks
Since you are using the absolute address
address="http://localhost:9000/employee"
You need configure httpj:engine-factory as described here[1]
[1]http://cxf.apache.org/docs/standalone-http-transport.html

giving the host url dynamically in mobilefirst adapter

Hello all I need to pass the host name or url for the adapter dynamically from the client side.i.e when the user login he needs to type the url which will be set to the ${domainname} in the adapter.xml file.help needed pls.Thnks in advance
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wl:adapter xmlns:wl="http://www.ibm.com/mfp/integration" xmlns:http="http://www.ibm.com/mfp/integration/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SoapAdapter1">
<displayName>SoapAdapter1</displayName>
<description></description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>${domain}</domain>
<port>8001</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>2</maxConcurrentConnectionsPerNode>
</connectionPolicy>
</connectivity>
<procedure name="userlog"></procedure>
</wl:adapter>
Those are not changeable values during runtime. You cannot decide dynamically where will the adapter connect to after the adapter has been built and deploy.
You could try Andrew's suggestion here: IBM Worklight - How to change dynamically domain/hostname to which the adapter connects from the client at launch or runtime?

Infinispan 5.3.0 - Using UDP protocol for multicasting without cluster configurations and JGroups

We are using Infinispan for caching on Tomcat 7.0. We found that Infinispan making UDP requests for multicasting without JGroups and cluster configuration. We observed Infinispan jar itself contains jgroups-udp.xml. But we are not referring it no where. Is infinispan by default uses UDP protocol for multi/uni casting the messages?
The cache configuration file we used is here.
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3">
<global>
<globalJmxStatistics enabled="true"/>
</global>
<namedCache name="FORMS">
<jmxStatistics enabled="true"/>
<eviction strategy="LIRS" maxEntries="1000" />
<expiration lifespan="86400000" /><!-- Setting expiration to 1 day -->
</namedCache>
</infinispan>

Mule application into a deployable WAR

How the Mule application can be directly convert into a war file, to deploy in Jboss application server, i tried and failed with creating the war file manually as mentioned here and gone through this too, but still didn't get a clear view on this part.Provide a assistance with example. Note: there is no Mule-config.xml file in my sample mule application program
In the pom.xml, ensure you have <packaging>war</packaging>
Create src/main/webapp/WEB-INF/web.xml using the template below, replacing YOUR_CONFIGS with a comma-separated list of Mule configurations and YOUR_PATH with the path you want for the Mule servlet,
Replace all your inbound HTTP endpoints with Servlet endpoints, like <servlet:inbound-endpoint path="/YOUR_ENDPOINT_PATH" />
And you should be good to go!
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<context-param>
<param-name>org.mule.config</param-name>
<param-value>YOUR_CONFIGS</param-value>
</context-param>
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
<servlet>
<servlet-name>muleServlet</servlet-name>
<servlet-class>org.mule.transport.servlet.MuleReceiverServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/YOUR_PATH/*</url-pattern>
</servlet-mapping>
</web-app>
EDIT I've open-sourced a running demo: https://github.com/ddossot/mule-webapp-example
Here you have the required steps:
http://www.mulesoft.org/documentation/display/current/Deploying+Mule+to+JBoss