Saturday, 6 February 2016

How to make datasource connection in JBOSS server

For data-source set-up on JBoss AS
1)  Make changes  in standalone.xml or standalone-full.xml  whichever you use
2)  Under <datasources> element add the below one
<xa-datasource jndi-name="java:jboss/datasources/appDS" pool-name="appDS" enabled="true" use-ccm="false">
                    <xa-datasource-property name="URL">
                        jdbc:oracle:thin:@//<ip address>:<port no>/<database environment>
                    </xa-datasource-property>
                    <driver>oracle</driver>
                    <xa-pool>
                        <is-same-rm-override>false</is-same-rm-override>
                        <interleaving>false</interleaving>
                        <pad-xid>false</pad-xid>
                        <wrap-xa-resource>false</wrap-xa-resource>
                    </xa-pool>
                    <security>
                        <user-name></user-name>
                        <password></password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </xa-datasource>

3) Provide the driver depending upon the database that you use say for Oracle add the below elements under <drivers> element ,

<driver name="oracle" module="com.oracle.db">
                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                    </driver>

Note : Important is that driver refers module: com.oracle.db.So please create folders in such a way as follows for Oracle

<JBOSS_HOME>\modules\system\layers\base\com\oracle\db\main\

4) Usually for Oracle there will be three files required such as Module.xml,ojdbc6.jar &  ojdbc6.jar.index
5) Module.xml will have the following entries
<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.1" name="com.oracle.db">

    <resources>
        <resource-root path="ojdbc6.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

How to resolve connection timeout issue while building through maven

If you see any such error while downloading any of the jars as following
Failed to read artifact descriptor for org.springframework.security:spring-security-core:jar:4.2.4.RELEASE: Could not transfer artifact org.springframework.security:spring-security-core:pom:4.2.4.RELEASE from/to mirror  (https://<maven repo path>): connection timed out to .......

Try to check the whether you have the appropriate nexus repo path as like below in pom.xml

  <distributionManagement>
         <repository>
             <id>depl</id>
            <url>http://<nexus path></url>
         </repository>
        <snapshotRepository>
             <id>depl-snapshot</id>
             <url>http://<nexus snapshot path></url>
        </snapshotRepository>
</distributionManagement> 

How to resolve application war not being deployed properly in JBOSS server

If you see any such following info in the server console

INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found xxx.war in deployment directory. To trigger deployment create a file called xxx.war.dodeploy

Try to create and place a file named xxx.war.dodeploy in deployments folder
say for EAP6.1 on standalone its C:\JBOSS\jboss-eap-6.4\standalone\deployments\

How to Convert Eclipse project to J2EE/Web project

1)  Right click on the Project.
2)  Click Properties
3)  Choose Project Facets
4)  Choose Dynamic web module check box(Choose the required version of it say 3.0/3.1)
5)  Choose Java and provide the required version which supports appropriate dynamic  web module version.

How to resolve Error "Dynamic Web Module 3.1 requires Java 1.7 or newer"

If you see the error while choosing Dynamic web module 3.1 from Project Facets(Right click on the Project and click on properties) then Choose Java (the required version of Java) and then click Apply.

How to add Maven Plugin in Eclipse Helios

Go to Help ==> Install New Software... ==>  Click on Add... button ==> Provide Name as Maven Tools & Location as http://download.eclipse.org/technology/m2e/releases/1.3

How to add Jboss Enterprise Server Tools in Eclipse Helios

Go to Help ==> Choose Install New Software... ==>  Click on Add... button ==> Provide Name as JBoss Tools & Location as  http://download.jboss.org/jbosstools/updates/stable/helios/