Deploy Apache Archiva web application archive (war) is not straight forward on WebLogic, although on apache site it declared that, it should be deploy on any J2ee server. This week we decided to upgrade our Archiva version from 1.3 to 1.3.3 and locate some interesting facts which should be fix to deploy on WebLogic server. In this following blog post you can get some useful information to deploy version 1.3 on WebLogic server. In this current post i am going to explain the maven way to fix all the problems among with Jpox ORM (we have oracle DB 10.3.1 as external database) and mailSession of Archiva to deploy on WebLogic. Most of all configuration you will get from the Apache Archiva site.
At first we have to download the source code of the Apache Archiva. You could found it here.Unzip the archive file and run mvn clean install -Dmaven.test.skip=true, it will download a few more plugin and dependency libraries to compile and install the artifact on you local machine (Assume that you already have mvn installed on your system).
Our aim is to add one weblogic.xml descriptor file to archiva-webapp/src/main/webapp/WEB-INF, add one maven ear module on archiva-web module to get ear artifact and edit archiva-base.xml file to change the column length.
First of all we will add following weblogic.xml in the \src\apache-archiva-1.3.3-src\archiva-modules\archiva-web\archiva-webapp\src\main\webapp\WEB-INF directory.
Next we have to make some change on archive-base.xml located on \src\apache-archiva-1.3.3-src\archiva-modules\archiva-base\archiva-model\src\main\mdo . By default Archiva released with Jpox orm which data base object mapping is not supported for Oracle data types. Change the mapping for column named "message" for table REPOSITORY_PROBLEMS as follows:
You could also set the data type to Clob in order to String. The above fixes is enough to get rid of the following errors on weblogic:
java.sql.SQLSyntaxErrorException: ORA-00910: specified length too long for its datatype
You can compile and build the artifact to deploy it to WebLogic, it will set the context root to archiva-web-1.3.3. In order to change the context root of the Archiva web application we can create a maven ear module on archiva-web directory as follows:
\src\apache-archiva-1.3.3-src\archiva-modules\archiva-web\
|--archiva-ear
|--archiva-xmlrpc
|--archiva-webapp
add the module in the archive-web pom.xml as follows:
archiva-ear
|----src\main\resources\META-INF\
|----pom.xml
pom.xml will have the following content:
Happy coding & happy new year.
At first we have to download the source code of the Apache Archiva. You could found it here.Unzip the archive file and run mvn clean install -Dmaven.test.skip=true, it will download a few more plugin and dependency libraries to compile and install the artifact on you local machine (Assume that you already have mvn installed on your system).
Our aim is to add one weblogic.xml descriptor file to archiva-webapp/src/main/webapp/WEB-INF, add one maven ear module on archiva-web module to get ear artifact and edit archiva-base.xml file to change the column length.
First of all we will add following weblogic.xml in the \src\apache-archiva-1.3.3-src\archiva-modules\archiva-web\archiva-webapp\src\main\webapp\WEB-INF directory.
<?xml version = '1.0' encoding = 'windows-1252'?> <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"> <resource-description> <res-ref-name>mail/Session <jndi-name>mail/Session </resource-description> </weblogic-web-app>Which will active resource location by jndi
Next we have to make some change on archive-base.xml located on \src\apache-archiva-1.3.3-src\archiva-modules\archiva-base\archiva-model\src\main\mdo . By default Archiva released with Jpox orm which data base object mapping is not supported for Oracle data types. Change the mapping for column named "message" for table REPOSITORY_PROBLEMS as follows:
<field stash.maxSize="4000"> <name>message</name> <identifier>false</identifier> <version>1.0.0+</version> <required>true</required> <type>String</type> <description> The origin of the health problem. </description> </field>Change the length of the field named "message" for table LICENSES as follows:
<field stash.maxSize="4000"> <name>comments</name> <version>1.0.0+</version> <type>String</type> <description> Addendum information pertaining to this license. </description> </field>Edit the length of the field named "description"for tables PROJECT as follows:
<field stash.maxSize="4000"> <name>description</name> <identifier>false</identifier> <version>1.0.0+</version> <required>false</required> <type>String</type> <description> The description of this project. </description> </field>
You could also set the data type to Clob in order to String. The above fixes is enough to get rid of the following errors on weblogic:
java.sql.SQLSyntaxErrorException: ORA-00910: specified length too long for its datatype
You can compile and build the artifact to deploy it to WebLogic, it will set the context root to archiva-web-1.3.3. In order to change the context root of the Archiva web application we can create a maven ear module on archiva-web directory as follows:
\src\apache-archiva-1.3.3-src\archiva-modules\archiva-web\
|--archiva-ear
|--archiva-xmlrpc
|--archiva-webapp
add the module in the archive-web pom.xml as follows:
<modules> <module>archiva-applet</module> <module>archiva-security</module> <module>archiva-webapp</module> <module>archiva-webdav</module> <module>archiva-rss</module> <module>archiva-xmlrpc</module> <module>archiva-ear</module> </modules>archiva-ear module will have the following structure:
archiva-ear
|----src\main\resources\META-INF\
|----pom.xml
pom.xml will have the following content:
<?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> <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> <version>1.3.3</version> </parent> <artifactId>archiva-ear</artifactId> <packaging>ear</packaging> <name>Archiva Ear :: Application</name> <dependencies> <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-webapp</artifactId> <version>1.3.3</version> <type>war</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <configuration> <earSourceDirectory>src/main/resources</earSourceDirectory> <version>5</version> <modules> <webModule> <groupId>org.apache.archiva</groupId> <artifactId>archiva-webapp</artifactId> <contextRoot>/archiva</contextRoot> </webModule> </modules> <archive> <addMavenDescriptor>false</addMavenDescriptor> <manifest> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>Add the following weblogic-application.xml into the archiva-web\archiva-ear\src\main\resources\META-INF directory
<?xml version = '1.0' encoding = 'windows-1252'?> <weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-application"> <application-param> <param-name>webapp.encoding.default</param-name> <param-value>UTF-8</param-value> </application-param> </weblogic-application>Now the code is complete and you can build and deploy to Weblogic server.
Happy coding & happy new year.
Comments