1 Reply Latest reply on Jun 2, 2015 5:32 AM by raghukanakala

    How to replicate same shared library in jboss

    raghukanakala

      I have a common library (JAR) that shouldn't be part of any application (EAR). I need to use runtime with the common JAR file with application. It is easy to do in web sphere through Admin console, could you any one help me to do in Jboss EAP 6.3.0.

        • 1. Re: How to replicate same shared library in jboss
          raghukanakala

          Hi All,

           

          I have resolved this issue by doing following steps.

          Sample project Structure used as common shared library for JBoss EAP 6.3.0.

          E:\DOCUMENTS\SHARED-EJB-CLIENT

          ├───pom.xml

          ├───src

          │├───main

          │├───java

          │└───com

          │└───sharedlib

          │└───util

          │ SimpleUtil.java

          └───target SharedLib -ejb-client-1.0-SNAPSHOT.jar

           

          StringUtil.java

          package com.techm.util;

          public class SimpleUtil {

          *public* String toString(){

          *return* "I am from SimpleUtil ";

          }

          }

          pom.xml

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

          <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

          <modelVersion>4.0.0</modelVersion>

          <groupId>SharedLib</groupId>

          <artifactId>SharedLib-ejb-client</artifactId>

          <version>1.0-SNAPSHOT</version>

          <packaging>ejb</packaging>

          <name>SharedLib EJB client module</name>

          <build>

          <plugins>

          <plugin>

          <artifactId>maven-ejb-plugin</artifactId>

          <version>2.3</version>

          <configuration>

          <ejbVersion>3.1</ejbVersion>

          <generateClient>false</generateClient>

          <archive>

          <addMavenDescriptor>true</addMavenDescriptor>

          <manifest>

          <addClasspath>true</addClasspath>

          </manifest>

          </archive>

          </configuration>

          </plugin>

          </plugins>

          </build>

          </project>

           

          GOTO "E:\Programs\EAP-6.3.0\jboss-eap-6.3\modules\system\layers\base " and create the folder " com\sharedlib\util\main\" Inside 'main' copy the shared library jar file " SharedLib -ejb-client-1.0-SNAPSHOT.jar " and then create a file module.xml with following content. Important make sure the package name consistent as given in project for ex: "package com.sharedlib.util" used for the file StringUtil.java make sure the dependency is added, this can be done using the command " mvn dependency:tree" inside the shared lib project. in this case it is executed inside " E:\DOCUMENTS\SHARED-EJB-CLIENT" and after the listing following dependency tag "org.jboss.as.logging" is added.

          module.xml

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

          <module xmlns="urn:jboss:module:1.1" name="com.sharedlib.util">

                <properties>

                     <property name="jboss.api" value="private"/>

                </properties>

                <resources>

                     <resource-root path="SharedLib-ejb-client-1.0-SNAPSHOT.jar"/>

                </resources>

                <dependencies>

                     <module name="org.jboss.as.logging"/>

                </dependencies>

          </module>

           

          standalone.xml

          <subsystem xmlns="urn:jboss:domain:ee:1.2">

                <global-modules>

               <module name="com.techm.util" slot="main"/>

                </global-modules>

                <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>

                <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>

          <annotation

           

          I hope it will help. Please send private message if anybody want any clarification on this solution.