Deployment of eservices-transformation module on JBoss 5.1.0.GA Default server instance

tenuousdrunkshipInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

77 εμφανίσεις

Deployment of eservices
-
transformation module on JBoss 5.1.0.GA
Default server instance


The successful deployment of the eservice transformation module to JBoss 5.1 server is based of
three

steps:

1.

Preparing the server
with

a datasource for

the application being deployed

2.

Preparing the eservices transformation module with required jboss specific configs

3.

Deploying the application with required libraries


Step #1: Setting up
MySQL Data Source


Create a file mysql
-
ds.xml inside the default serve
r’s deploy directory and add the following contents to
it (make the appropriate changes inside the configuration to apply for your environment)

<?xml version="1.0" encoding="UTF
-
8"?>

<datasources>


<local
-
tx
-
datasource>


<jndi
-
name>jdbc/MetaInformation
Database</jndi
-
name>


<use
-
java
-
context>false</use
-
java
-
context>


<connection
-
url>jdbc:mysql://
YOURHOST
:3306/spocs_wp4_midb</connection
-
url>


<driver
-
class>com.mysql.jdbc.Driver</driver
-
class>


<user
-
name>
USERNAME
</user
-
name>


<password>
PASS
WORD
</password>


<exception
-
sorter
-
class
-
name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception
-
sorter
-
class
-
name>


<metadata>


<type
-
mapping>mySQL</type
-
mapping>


</metadata>


</local
-
tx
-
datasource>

</datasources>

Requ
ired c
hanges
marked as

bold

in the above example configuration. If you need different
configuration attributes, such as connection
-
url, you may specify so to accommodate your running
environment.

The
orange
line tells JBoss not to map the jndi contexts to
the java:/ environment,
otherwise similar mapping references have to be made in all configs below.



Step #
2
: Setting up
eservices
-
transformation web application archive (WAR)


This section will focus on the xml configuration / deployment files of the web
application being deployed
and their settings. Please note that if your environment requires different settings than the ones
outlined below, changes have to be consistent through all references in the configs.

WEB
-
INF/web.xml


<?xml

version="1.0" encoding="UTF
-
8"?>

<web
-
app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"


xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance"


xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web
-
app_2_5.x
sd">


<display
-
name>eu.spocseu.eservices.transformation.ws</display
-
name>


<context
-
param>



<param
-
name>contextConfigLocation</param
-
name>



<param
-
value>classpath:transformation
-
ws
-
application
-
context.xml</param
-
value>


</context
-
param>


<co
ntext
-
param>



<param
-
name>configProperties</param
-
name>



<param
-
value>
C:/etc/spocs/config.properties
</param
-
value>


</context
-
param>


<persistence
-
context
-
ref>



<persistence
-
context
-
ref
-
name>midbPersistence</persistence
-
context
-
ref
-
name>



<
persistence
-
unit
-
name>midbPersistence</persistence
-
unit
-
name>


</persistence
-
context
-
ref>


<listener>



<listener
-
class>org.springframework.web.context.ContextLoaderListener</listener
-
class>


</listener>


<listener>



<listener
-
class>com.sun.xml.ws.transpo
rt.http.servlet.WSServletContextListener</listener
-
class>


</listener>



<servlet>



<servlet
-
name>Transformation</servlet
-
name>



<servlet
-
class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet
-
class>



<load
-
on
-
startup>1</load
-
on
-
startup>


</serv
let>


<servlet
-
mapping>



<servlet
-
name>Transformation</servlet
-
name>



<url
-
pattern>/Transformation</url
-
pattern>


</servlet
-
mapping>

</web
-
app>

Bolded text could be modified as per your environment needs and the shared folder that contains the
SPOCS spec
ific configuration files.


WEB
-
INF/sun
-
jaxws.xml


<endpoints

xmlns="http://java.sun.com/xml/ns/jax
-
ws/ri/runtime" version="2.0">


<endpoint name="Transformation" implementation="eu.spocseu.eservices.transformation.ws.TransformationImpl"


url
-
pattern="/T
ransformation" />

</endpoints>


WEB
-
INF/classes/

transformation
-
ws
-
application
-
context
.xml


<?xml version="1.0" encoding="UTF
-
8"?>

<beans xmlns="http://www.springframework.org/schema/beans"


xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance"


xsi:schema
Location=" http://www.springframework.org/schema/beans
http://www.springframework.org/schem
a/beans/spring
-
beans.xsd">


<bean


class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">


</bean>


<bean id="transformationImp
l"



class="eu.spocseu.eservices.transformation.ws.TransformationImpl">



<constructor
-
arg>




<value>${configProperties}</value>



</constructor
-
arg>


</bean>


<bean


class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"
/>

<bean id="sessionFactory" factory
-
bean="entityManagerFactory"



factory
-
method="getSessionFactory" />


<bean id="SPOCSConfigDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">



<property name="jndiName" value="jdbc/MetaInformationDataba
se" />



<property name="resourceRef" value="true" />


</bean>




<bean id="entityManagerFactory"


class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">



<property name="persistenceUnitName" value="midbPersistence" />



<property nam
e="dataSource" ref="SPOCSConfigDataSource" />


</bean>


<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">



<property name="entityManagerFactory" ref="entityManagerFactory" />



<property name="
nestedTransactionAllowed" value="false" />


</bean>

</beans>


WEB
-
INF
\
classes
\
META
-
INF
\
persistence.xml


<?xml version="1.0" encoding="UTF
-
8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence"


xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance
"


xsi:schemaLocation="http://java.sun.com/xml/ns/persistence


http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"


version="1.0">


<persistence
-
unit name="midbPersistence" transaction
-
type="RESOURCE_LOCAL">



<!
--

The provider only needs to be s
et if you use several JPA providers
--
>



<provider>org.hibernate.ejb.HibernatePersistence</provider>





<non
-
jta
-
data
-
source>jdbc/MetaInformationDatabase</non
-
jta
-
data
-
source>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Access.hbm.xml</mapping
-
file
>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Attributes.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Change.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Condition.hbm.xml</mapping
-
file>



<mapp
ing
-
file>eu/spocseu/midb/hibernate/mapping/Doc.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Doctype.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Dtext.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu
/midb/hibernate/mapping/Eagency.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Einter.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Equivalence.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibe
rnate/mapping/Eservice.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Etext.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Language.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping
/Needdoc.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Org.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Otext.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Outdoc.hbm.xml<
/mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Parameter.hbm.xml</mapping
-
file>



<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Prof.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Routing.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Sagency.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Service.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Ses.hbm.xml</mappin
g
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Sinter.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Status.hbm.xml</mapping
-
file>


<mapping
-
file>eu/spocseu/midb/hibernate/mapping/Stext.hbm.xml</mappi
ng
-
file>


<properties>




<property name="hibernate.bytecode.use_reflection_optimizer" value="false" />




<property name="hibernate.cache.use_query_cache" value="false" />




<property name="hibernate.cache.use_second_level_cache" value="false" />




<property name="hibernate.current_session_context_class"
value="org.hibernate.context.ThreadLocalSessionContext" />




<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />




<property name="hibernate.search.autoregiste
r_listeners" value="false" />



</properties>


</persistence
-
unit>

</persistence>


META
-
INF/context.xml


<?xml version="1.0" encoding="UTF
-
8"?>

<Context>


<ResourceLink global="SyndicationConnectionPool" name="jdbc/SyndicationDatabase"/>


<ResourceLink glo
bal="MIDBConnectionPool" name="jdbc/MetaInformationDatabase"/>

</Context>


Step #
3
:
Deploying the web application


WEB
-
INF/lib/

folder


The lib folder of the web
-
inf

folder contains the required libraries / dependencies needed in
order for the eservices
-
transformation module to function properly. The following list has been
adapted from the original Tomcat deployment archive, as many of the libraries are present in
th
e JBoss lib folder by default.



Following the previous two sections, and all
the
configuration
sections
ha
ve

been done and
ready for the target environment, the deployment is basically copying the e
-
services
-
transformation.war

archive to the server’s deploy directory. If needed, restart the server if it is
not configured to automatically deploy newly copied archives.



Notes
:


Deployment of the eservices
-
transformation module as explained in this
document

is performed on the
de
fault server configuration. Depending on your environment it may not be the case, hence if the above
steps do not provide an out of the box deployment,
you would have to check that all necessary
dependencies are present in the
servers’

common library folde
r.