Migrating applications to JBOSS AS7 or JBOSS 7
- Migrate to JBOSS7
- Migrate to Jboss 7
- Migrating to JBOSS EAP6
- Migrating applications from Websphere to JBOSS AS 7
- JBOSS 7 Migration guide
There are several aspects that are different in JBOSS 7 like
- The way you load resources from classpath (Its not the usual java way weird J)
- The classloading problem can be dealt easily with the jboss-deployment-structure.xml (Its awesome !!)
- The speed at which jboss starts and stop’s is nowhere close Websphere . Jboss is superfast.
In Jboss you use standalone mode if you have single instance of a server in cases where you have multiple servers you use domain mode. In standalone mode Jboss server uses standalone.xml and in domain mode we end using domain.xml.
Assuming you have jboss deployed under C:\jboss-eap-6.0. Before you can declare a data source you need to install a driver.
Installing oracle database driver in JBOSS 7 or EAP 6:
- Download ojdbc6.jar
- On your local go to C:\jboss-eap-6.0\modules
- Create a directory structure C:\jboss-eap-6.0\modules\com\oracle\ojdbc6\main
- Add the jar “ojdbc6.jar” in to C:\jboss-eap-6.0\modules\com\oracle\ojdbc6\main
- Create file called module.xml and add the following contents to it
C:\jboss-eap-6.0\modules\com\oracle\ojdbc6\main\module.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- C:\jboss-eap-6.0\modules\com\oracle\ojdbc6\main The module name, "com.oracle.ojdbc6", should match the directory structure for this module. --> <module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6"> <resources> <resource-root path="ojdbc6.jar" /> </resources> <dependencies> <module name="javax.api" /> </dependencies> </module>
Installing Microsoft SQL server database driver in JBOSS 7 or EAP 6:
- Download sqljdbc.jar
- On your local go to C:\jboss-eap-6.0\modules
- Create a directory structure C:\jboss-eap-6.0\modules\com\microsoft\sqlserver\main
- Add the jar “sqljdbc.jar” in to C:\jboss-eap-6.0\modules\com\microsoft\sqlserver\main
- Create file called module.xml and add the following contents to it
<?xml version="1.0" encoding="UTF-8"?> <!-- C:\servers\jboss-eap-6.0_sco\modules\com\microsoft\sqlserver\main The module name, "com.microsoft.sqlserver", matches the directory structure for this module. --> <module xmlns="urn:jboss:module:1.0" name="com.microsoft.sqlserver"> <resources> <resource-root path="sqljdbc.jar" /> </resources> <dependencies> <module name="javax.api" /> <module name="javax.transaction.api" /> </dependencies> </module>
Sweet we now have installed the drivers and we can now reference these drivers in standalone.xml (or domain.xml if its domain mode) which is the file that Jboss reads to load your data sources, Queues, connection factories, name space bindings….etc
Adding a Datasource in JBOSS 7 or EAP 6 :
In your standalone.xml or domain.xml (eg: C:\jboss-eap-.0\standalone\configuration\standalone.xml) go the following section “<subsystem xmlns="urn:jboss:domain:datasources:1.1">“
(This part of the section from standalone.xml)
Please note that in the above snippet<subsystem xmlns="urn:jboss:domain:datasources:1.1"><datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"> <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url> <driver>h2</driver> <security> <user-name>sa</user-name> <password>sa</password> </security> </datasource> <datasource jta="true" jndi-name="java:/jdbc/RAMA_TST_DB" pool-name="TSTDBPoolName" enabled="true" use-java-context="true"> <connection-url>jdbc:oracle:thin:@rama-local:2111:MYSCHEMA</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <driver>ojdbc6.jar</driver> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <security> <user-name>scott</user-name> <password>tiger</password> </security> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> </driver> <driver name="ojdbc6.jar" module="com.oracle.ojdbc6" /> </drivers> </datasources>
- We referenced the name of the driver we installed under <drivers> section <driver name="ojdbc6.jar" module="com.oracle.ojdbc6"/>
- The name "ojdbc6.jar" can be anything I just used the name of the jar for simplicity.
- Now reference the name that you gave this driver in the data source section along with database credentials and connection String.
- The property use-java-context="true" will bind the data source java:/ if you set it to false the pre qualifier java will be omitted and your data source will be just jdbc/RAMA_TST_DB
In your Spring code you can access this data source as shown below
<bean id="testDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value=" java:/jdbc/RAMA_TST_DB " /> </bean>
Adding Name Space bindings in JBOSS 7 or EAP 6:
In standalone.xml look for the section that says “<subsystem xmlns="urn:jboss:domain:naming:1.2">”
<?xml version="1.0" encoding="UTF-8"?> <subsystem xmlns="urn:jboss:domain:naming:1.2"> <bindings> <simple name="java:/tstapp/keyStorePassword" value="abc" /> <simple name="java:/tstapp/signingKeyCertPassword" value="xyz " /> <simple name="java:/tstapp/encrytpionKeyCertPassword" value="test " /> <simple name="java:/tstapp/maxretries" value="10" /> <simple name="java:/tstapp/adminemail" value="email@gmail.com" /> </bindings> <remote-naming /> </subsystem>You can refer the namespace using spring as shown below
<bean id="envType" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value=" java:/tstapp/keyStorePassword " /> </bean>
Adding resources to Class Path in JBOSS7 or EAP 6:
To add resources to class path you need to create a module and drop all the files that you want to read in classpath under this module.
- The module can be created anywhere in which case you need to inform JBOSS server by Windows:
- set JBOSS_MODULEPATH=%JBOSS_HOME%/modules;/path/to/my/modules
- If you are on mac or unix, use export and colons. i.e
- export JBOSS_MODULPATH=$JBOSS_HOME/modules:/path/to/my/modules
- In case you created the module under C:\jboss-eap-6.0\modules\ Then we don’t need to export as this path is already present by default.
This is how you create the module.
- Create a folder called “custom_properties” (This name can be anything. I just choose this)
- Create a subfolder called main ie. “custom_properties\main”
- In main add module.xml with following contents.
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="custom_properties"> <resources> <resource-root path="." /> </resources> </module>
How to write the
jboss-deployment-structure.xml?
Now
in your web/ejb/ear application you can reference these modules using
jboss-deployment-structure.xml as shown below.
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns:p="urn:jboss:deployment-structure:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ear-subdeployments-isolated>true</ear-subdeployments-isolated> <deployment> <dependencies> <!-- load Custom Properties module. By saying true we are telling that this module is available for any war file or ejb jar Files if this xml is part of ear file --> <module name="custom_properties" export="true" /> </dependencies> </deployment> </jboss-deployment-structure>
Where to add
jboss-deployment-structure.xml?
As
mentioned earlier you can copy the jboss-deployments-structure.xml to META-INF
folder if it’s a EAR project or EJB project or in WEB-INF folder if it’s a war
file.
Eg:
YOUR-EAR/META-INF/jboss-deployment-structure.xml
YOUR-WAR/WebContent/WEB-INF/jboss-deployment-structure.xml
This
file has several other tags.
The
XSD give more insight
How to exclude or include
jars in classpath for Jboss 7 or EAP 6 ?
We
can influence class loading in Jboss server by including or excluding any
modules that Jboss loads on start up. You can add this xml at EAR or level or
at WAR level depending on whether you have to influence entire EAR project or
localize to just WAR project
Eg:
Say you are running a JSF 1.2 based application and you want to exclude JSF2.0
jars that JBOSS loads by default you do this.
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment> <dependencies> <!-- Name of module that points to custom properties --> <module name="custom_properties" export="true" /> </dependencies> <!-- 1.Excludes JSF 2.x which is one of the default modules in JBOSS. The property slot refers to version. --> <exclusions> <module name="javax.faces.api" slot="main" /> <module name="com.sun.jsf-impl" slot="main" /> </exclusions> </deployment> </jboss-deployment-structure>
So
you may wonder how we got these values
name="javax.faces.api"
slot="main"
and
name="com.sun.jsf-impl"
slot="main"
Well
these are the values from module.xml for jsf 2.0 jars in JBOSS which is at
JBOOS_HOME\modules\javax\faces\api\main\module.xml
More
info on default modules in JBOSS 7 at
I will show you another example of
jboss-deployment-structure.xml.
We were deploying Openam as web application and we
started seeing the below errors
1. "Caused by: java.lang.IllegalArgumentException:
JBAS015533: Web Service endpoint
com.sun.xml.ws.tx.webservice.member.coord.ActivationRequesterPortTypeImpl with
URL pattern
/Coordinator is already registered. Web service endpoint
com.sun.xml.ws.tx.webservice.member.coord.RegistrationRequesterPortTypeImpl
is requesting the
same URL pattern."
2. [OpenAM]
java.lang.ClassCastException:
com.sun.org.apache.xml.internal.security.transforms.implementations.TransformEnvelopedSignature
cannot be cast to com.sun.org.apache.xml.internal.security.transforms.TransformSpi
Also by default the sun.jdk module in Jboss doesn’t load
the following
<path name="sun/security/x509" />
<path name="sun/net/www/protocol/http" />
<path name="com/sun/net/ssl/internal/ssl"
/>
Jboss-deployment-structrue.xml
(Shows how to redefine an existing
jboss module by excluding some default classes)
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> <deployment> <exclusions> <!-- All this trouble just to exclude com/sun/org/apache/xml/internal/security/transforms/implementations" --> <module name="sun.jdk" /> </exclusions> <dependencies> <module name="sun.jdk"> <imports> <include-set> <!-- (start new dependencies) --> <path name="sun/security/x509" /> <path name="sun/net/www/protocol/http" /> <path name="com/sun/net/ssl/internal/ssl" /> <!-- (end new dependencies) --> <path name="com/sun/script/javascript" /> <path name="com/sun/image/codec/jpeg" /> <path name="com/sun/jndi/dns" /> <path name="com/sun/jndi/ldap" /> <path name="com/sun/jndi/url" /> <path name="com/sun/jndi/url/dns" /> <path name="sun/print" /> <path name="sun/print/resources" /> <!-- (suppressed unwanted dependencies; see exclude-set below) --> <!-- <path name="com/sun/org/apache/xml/internal/security/transforms/implementations"/> --> <path name="com/sun/security/auth" /> <path name="com/sun/security/auth/login" /> <path name="com/sun/security/auth/module" /> <path name="sun/font" /> <path name="sun/misc" /> <path name="sun/io" /> <path name="sun/nio" /> <path name="sun/nio/ch" /> <path name="sun/security" /> <path name="sun/security/krb5" /> <path name="sun/util" /> <path name="sun/util/calendar" /> <path name="sun/util/locale" /> <path name="sun/util/resources" /> <path name="sun/security/provider" /> <path name="sun/text" /> <path name="META-INF/services" /> </include-set> <exclude-set> <path name="com/sun/org/apache/xml/internal/security/transforms/implementations" /> </exclude-set> </imports> </module> </dependencies> <exclude-subsystems> <subsystem name="jaxrs" /> <subsystem name="webservices" /> </exclude-subsystems> </deployment> </jboss-deployment-structure>
How to
troubleshoot “startup failed due to previous errors” in JBOSS 7?
Whenever
you see your ear deployment failing with the error “Startup failed due to previous
error” and with no other exception in the server.log its very annoying. By
default Jboss doesn’t show you all the errors when one of the modules with ear
fails which is weird?
Why
would anyone hide the exceptions and just say “Something went wrong”
Well
there is way we can tell JBOSS to spill the beans (I mean to show exception for
each failed module within the ear)
If you want errors to show for individual artifacts (like
war or ejb-jar within ear)
Add the following
entry "-Dorg.jboss.as.logging.per-deployment=false"
You
can add this in to your servers start up script or if you are using some IDE
like eclipse
- Double click on the server
- Once the server pane opens click one “Edit launch configuration”
Go
to Arguments tab and within that go to “VM arguments “ and add "-Dorg.jboss.as.logging.per-deployment=false"
How To enable logging of JBOSS class loading ?
Or
How to explore
which classes are loaded from which JARs?
Or
How to find which
jars and in what order are loaded by a classloader?
In case you want to troubleshoot JBOSS Classloading issue
and see which class is being loaded from which jar and you don’t want to change any code ( I will show a trick how to find the jar
file name a class belongs to in case you can change the code )
In your standalone.xml or domain.xml (or
standalone-ha.xml or standalone-full-ha.xml depending on which file you are
using) go to the below section as shown here
<profile>
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE">
<level name="DEBUG"/> =è
default will be INFO
Also to JAVA_OPTS add "-verbose:class" this is parameter to java command don’t use
–D.
Either you can edit standalone.conf.bat or add this param using eclipse by opening
the launch configuration.
NOTE: This option generates too much information of every class that is being loaded and should only be used for troubleshooting.
However
if you can change the code and want to see a specific classes and where they
are being loaded from here is the trick.
Use
this line of code on your object or class and you should see the jar file name
in most cases.
I
tried it on JBOSS 7 and it worked and on other hand the same line of code did
not work in Websphere 7.
yourobject.getClass().getProtectionDomain().getCodeSource()e.g.: I wanted to from where I was loading the FOPFactory fromFopFactory fopFactory = FopFactory.newInstance();System.out.println("fopFactory was loaded from :"+ fopFactory.getClass().getProtectionDomain().getCodeSource());Output:fopFactory was loaded from :(file:/C:/ workspace/TESTXSLFO/lib/fop-0.95-1.jar <no signer certificates>)
How to enable session replication
in JBOSS 7 or EAP 6?
Assuming
you have setup clustering and you app is being deployed on more than one
server,
In
your web application all we need to do is include the tag
<distributable/>
Web.xml
<web-app xm lns="http://java.sun.com /xm l/ns/j2ee"
xm lns:xsi=http://www.w3.org/2001/XMLSchem a-instance xsi:schem
aLocation=http://java.sun.com
/xm l/ns/j2ee http://java.sun.com /xm l/ns/j2ee/webapp_2_4.xsd version="2.4">
<distributable/>
</web-app>
In
addition if you need to make any more changes you can modify the following
properties which are in jboss-web.xml (This file is part of your web
application)
NOTE:
By default these are the values that JBOSS uses. You don’t need mention these
values are this entire section <replication-config> to </replication-config> unless you have strong reason to change the
values. When I tested I did not include this section in my jboss-web.xml
Jboss-web.xml
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"><jboss-web><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> <session-notificationpolicy>com .exam ple.Custom SessionNotificationPolicy</session-notificationpolicy> </replication-config> </jboss-web>
My
jboss-web.xml looked like below without any overrides for default values: (Because I just used
defaults)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"> <jboss-web> <context-root>TST</context-root> </jboss-web>
Sample JSP page to test
session replication:
Copy
paste the below few lines into jsp page and let’s call it as SessionInfo.jsp.
Now if you have two nodes just start one node and use your application generic
url and you will see say session id : abc
and server name : server1 and later start node 2 and shutdown node1 and
refresh the page you will see that the server name on the jsp page will change
to server2 but session id will remain same. Proving the session migrated from
server1 to server 2.
SessionInfo.jsp
<%@ page import="java.net.InetAddress"%>
<html>
<head>
<title>Session Details</title>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" >
<div id="sessiondetails">
<h1>Your Session Details</h1>
<p class="simpleText"> Your Remote Host: <%= request.getRemoteHost() %> </p>
<p class="simpleText"> Your Server Name: <%= request.getServerName() %> </p>
<p class="simpleText"> Your Server Port: <%= request.getServerPort() %> </p>
<p class="simpleText"> Your Host name : <%= InetAddress.getLocalHost().getHostName() %></p>
<p class="simpleText"> Your Session ID: <%= request.getSession().getId() %> </p>
<p class="simpleText"> Creation time: <%= request.getSession().getCreationTime() %></p>
<p class="simpleText"> LastAccessedTime time: <%= request.getSession().getLastAccessedTime() %></p>
<p class="simpleText"> MaxInactiveInterval time: <%= request.getSession().getMaxInactiveInterval() %></p>
</div>
</body>
</html>
Before you test there is one last change on server side
we need to make to specify the cache mode and number of owners. Based on what I read here it looks like DIST
mode is better and number of owners should be set to “2”
1. Go to command prompt in windows or shell prompt in
unix/linux.
2. cd JBOSS_HOME/bin
3. ./jboss-cli.sh
(In case you change the host
name from localhost to some other name you may need to update the following in <host>localhost</host>
in jboss-cli.xml )
5. You will get a prompt like [disconnected /]
6. Now type the command "connect" (Without
quotes)
7. And now copy past the following line.
/profile=full-ha/subsystem=infinispan/cache-container=web/distributed-cache=dist/:write-attribute(name=owners,value=2)
NOTE: The above command is for profile by name “full-ha”
in case you are using default profile then you can remove the profile name.
/subsystem=infinispan/cache-container=web/distributed-cache=dist/:write-attribute(name=owners,value=2)
Owners: The owner’s parameter controls how many
cluster nodes hold replicated copies of the session. The default is 2.
Re
start the servers and test it out
NOTE:
In fact you can use jboss-cli (jobs command line interface) for setting data
sources, queues, check data pool statistics etc
Here
is on example of how
Monitor datasource
connection pool on Jboss using jboss cli:
Connect
to Jboss server using jboss-cli.bat or jboss-cl.sh. (Please see the previous
steps to connect to jboss in detail using cli)
If
you don’t have profile for your server use this: (i.e you jboss server is using
default profile)
/subsystem=datasources/data-source=TST_DS/statistics=pool:read-resource(include-runtime=true)
If you have profile and the name of
profile is full-ha use this (If different profile please change accordingly)
/profile=full-ha/subsystem=datasources/data-source=TST_DS/statistics=pool:read-resource(include-runtime=true)
Here we are assuming your data source
name is TST_DS. Replace the name to match yours.
Output:
[standalone@localhost:9999 /]
/subsystem=datasources/data-source=TST_DS/statistics=pool:read-reso
urce(include-runtime=true)
{
"outcome"
=> "success",
"result"
=> {
"ActiveCount" => "0",
"AvailableCount" => "20",
"AverageBlockingTime" => "0",
"AverageCreationTime" => "0",
"CreatedCount" => "0",
"DestroyedCount" => "0",
"MaxCreationTime" => "0",
"MaxUsedCount" => "0",
"MaxWaitTime" => "0",
"TimedOut" => "0",
"TotalBlockingTime" => "0",
"TotalCreationTime" => "0"
}
}
Migrating JSF Web applications to JBOSS 7 or
EAP 6:
JBOSS
EAP 6 by default comes with both JSF 1.2 and JSF 2.0 jars. If you want to force
your web application to load the JSF jar that’s in your web-inf/lib folder you
need to exclude the JBOSS version of JSF jars.
Add
jboss-deployment-structure.xml with the following contents to WEB-INF if its
war or META-INF if its ear file. I added
it to my EAR file
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns:p="urn:jboss:deployment-structure:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ear-subdeployments-isolated>true</ear-subdeployments-isolated> <deployment> <dependencies> <!-- Custom Properties was my won module to load some property files --> <module name="custom_properties" export="true" /> </dependencies> </deployment> <sub-deployment name="yourwarFileName.war"> <exclusions> <module name="javax.faces.api" slot="main" /> <module name="com.sun.jsf-impl" slot="main" /> <module name="javax.faces.api" slot="1.2" /> <module name="com.sun.jsf-impl" slot="1.2" /> </exclusions> </sub-deployment> </jboss-deployment-structure>
NOTE:
In case you add this file to war file then you don’t need sub-deployment tag.
Since
we were jsf 1.2 myfaces it started complaining with the below exception
As
result my faces started complaining with the below error.
Caused by:
java.lang.InstantiationException: org.ajax4jsf.framework.DebugLifecycleFactory
at java.lang.Class.newInstance(Class.java:359)
[rt.jar:1.7.0_25]
Add
the following to web.xml. This tells my faces to use the JSF jar that we are bundling with war
file.
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
For
all Ajax calls I was getting this error.
java.lang.IllegalStateException:
Parameters processing failed.
at
org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:407)
[jbossweb-7.0.16.Final-redhat-1.jar:]
Root Cause:EAP 6.0.0.BETA used JBoss
Web 7.0.10.FINAL and as such some changes were made between the BETA and the
GA. Included in these changes was some refactoring of code to improve
performance and this included a flag to register parsing errors. If an improper
http parameter was received it throws an IllegalStateException. In the BETA
this error was just logged as it was not critical. Now this change is breaking
existing applications using certain browsers.
FIX
IT:
https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=13823
This
is what we need to do :
- Download JBPAPP-9500.zip from https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=13823
- Go to JBOSS_EAP_6_HOME\modules\org\jboss\as\web\main
- Remove jbossweb-7.0.16.Final-redhat-1.jar , jbossweb-7.0.16.Final-redhat-1.jar.index and module.xml
- Copy jbossweb-7.0.16.Final-redhat-1-JBPAPP-9500.jar and module.xml from JBPAPP-9500.zip to JBOSS_EAP_6_HOME\modules\org\jboss\as\web\main
NOTE: Once we re-start
“jbossweb-7.0.16.Final-redhat-1-JBPAPP-9500.jar.index” will get generated.
Next
Exception I got was
Caused by:
java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl
FIX:
Added this in jboss-deployment-structure.xml and copy the xml to
YOUREAR/META-INF or if no ear copy to WEB-INF folder in war file.
Jboss-deployment-struture.xml
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns:p="urn:jboss:deployment-structure:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ear-subdeployments-isolated>true</ear-subdeployments-isolated> <deployment> <dependencies> <!-- Custom Properties --> <module name="custom_properties" export="true" /> <system export="true"> <paths> <path name="com/sun/rowset" /> <path name="com/sun/rowset/internal" /> <path name="com/sun/rowset/providers" /> </paths> </system> </dependencies> </deployment> </jboss-deployment-structure>
JBOSS Transaction manager
In
my spring application.xml I
changed the transaction manager to below values.
<!--
Jboss should work with this alone.
The default name space is not
java:comp/UserTransaction
-->
<bean
id="OracleTxManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName"
value="java:jboss/TransactionManager"/>
</bean>
In
my hibernate.cfg.xml I
changed the manager lookup class to
<prop
key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.JBossTransactionManagerLookup
</prop>
Migrating Webservices to
Jboss:
There
is not much you need to do to migrate web services from other servers to JBOSS
as long you are using annotations. Since our applications are deployed on
multiples servers we have one generic url for webservice. We use mod cluster to
load balance the traffic to individual servers. However the rendered WSDL was
returning us the ip address and port number of individual servers instead of
the generic Webservice URL
How to set JBOSS Webservice
endpoint to have the address that client requested?
This
is what we have to do to get the correct end point address in WSDL. In your
Standlaone.xml or domain.xml set
wsdl-host to jbossws.undefined.host
<subsystem
xmlns="urn:jboss:domain:webservices:1.1">
<wsdl-host>jbossws.undefined.host</wsdl-host>
<modify-wsdl-address>true</modify-wsdl-address>
Read
more at :
I will add some notes on migrating EJB's to JBOSS shortly to this article.