Deploy to JBoss 7


This is a brief technical memory to deploy with JBoss 7, any comments or observations are welcome

REQUIREMENTS

  • To deploy with JBoos 7 requiered install and to configured the environment variables for maven 3 and Java 7

  • This is optional, you can define a goal for maven with:

<build>

    <finalName>project name</finalName>

    <plugins>

      <plugin>

         <groupId>org.apache.maven.plugins</groupId>

         <artifactId>maven-war-plugin</artifactId>

         <version>2.3</version>

         <executions>

            <execution>

               <phase>package</phase>

               <configuration>

                  <webXml>WEB-INF/web.xml</webXml>

               </configuration>

            </execution>

         </executions>

      </plugin>

   </plugins>

  </build>

INSTALLLING JBOSS 7

 

Unpackage the jboss-as-7.0.0.Final.zip in the next location

C:\Development_Tools\JBoss

Configure the JBOSS_HOME with the JBoss path

Generate war file executing the next maven command in the location where is the pom file

  • mvn clean install

 Copy the war file generated from

C:\Development_Tools\EclipseWorkspace\WebsiteServices\target

 To

 C:\Development_Tools\JBoss\jboss-as-7.0.0\jboss-as-7.0.0\standalone\deployments

Copy properties file to next location

 C:\Development_Tools\JBoss\jboss-as-7.0.0\jboss-as-7.0.0\standalone\configuration

 

Modify the standalone.xml adding next sections with proper data:

<system-properties>

        <property name=”service.endpoint.jndi.location” value=”jnp://es-jndi-dev.something.com:8180″/>

        <property name=”website.services.properties.file.location” value=”WebsiteServices.properties”/>

    </system-properties>

<subsystem xmlns=”urn:jboss:domain:datasources:1.0″>

            <datasources>

                <datasource jndi-name=”java:/OracleDS” pool-name=”OracleDS_Pool” enabled=”true” jta=”true” use-java-context=”true” use-ccm=”true”>

                    <connection-url>

                        jdbc:oracle:thin:@name.company.com:1521:WEBDEV

                    </connection-url>

                    <driver>jdbc.driver.OracleDriver

                    </driver>

<new-connection-sql>

select 1 from dual

</new-connection-sql>

<pool>

<min-pool-size>

5

</min-pool-size>

<max-pool-size>

20

</max-pool-size>

<prefill>

false

</prefill>

<use-strict-min>

true

</use-strict-min>

<flush-strategy>

FailingConnectionOnly

</flush-strategy>

</pool>

<security>

<user-name>

WEBDB

</user-name>

<password>

wRuzuf5E

</password>

</security>

<validation>

<check-valid-connection-sql>

select 1 from dual

</check-valid-connection-sql>

<validate-on-match>

false

</validate-on-match>

<background-validation>

false

</background-validation>

<useFastFail>

false

</useFastFail>

</validation>

<timeout>

<idle-timeout-minutes>

45

</idle-timeout-minutes>

<query-timeout>

600

</query-timeout>

</timeout>

<statement>

<track-statements>

TRUE

</track-statements>

</statement>

</datasource>

 

 Finally you can run the bat for JBoss 7.0 with the following command  in this location

C:\Development_Tools\JBoss\jboss-as-7.0.0\jboss-as-7.0.0\bin

 Encrypting datasource password

 export  JBOSS_HOME=/apps/jboss/jboss-as

export CLASSPATH=$JBOSS_HOME/modules/org/picketbox/main/picketbox

-4.0.7.Final.jar:$JBOSS_HOME/modules/org/jboss/logging/main/jboss-logging-3.1.0.GA.jar:$CLASSPATH

java  org.picketbox.datasource.security.SecureIdentityLoginModule  mypassword

Encoded password: -50fa369660ea3144207a6dde3d75616de44

 Define the application policy for the corresponding datasource  

<application-policy name = “WebDBPassword”>

<authentication>

<login-module code = “org.jboss.resource.security.SecureIdentityLoginModule” flag = “required”>

<module-option name = “username”>WEBDB</module-option>

<module-option name = “password”>-50ba369694jfk40la3144207a6df87216de44</module-option>

<module-option name =“managedConnectionFactoryName”>

jboss.jca:service=LocalTxCM,name=OracleDS

</module-option>

</login-module>

</authentication>

</application-policy>

Leave a comment