Skip to main content

Deploy apache archiva 1.3.3 on Oracle Weblogic server

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.
<?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

Popular posts from this blog

Apache Ignite deep dive, SQL engine

Apache Ignite  is an open source memory-centric distributed database, caching and comput- ing platform. From the beginning, it was designed as an in-memory data grid for developing a high-performance software system. So, it’s core architecture design is slightly different from the traditional NoSQL databases, which can simplify building modern applications with a flexible data model and simpler high availability, high scalability.     Moreover, to understand how to design application with any databases or framework properly, you must understand the architecture of the database or framework itself. By getting a better idea of the system, you can solve different problems in your enterprise architecture landscape, can select a comprehensive database or framework that is appropriate for your application and get the maximum benefits from the system. In this article we are going to explore the Apache Ignite SQL engine.      Under the hood...

Book review: High Performance in-memory computing with Apache Ignite by Sadruddin Md

A new title  The Apache Ignite book  has been released including Ignite 2.6 and above. Read the full book review by Sadruddin Md .

Quick start with In memory Data Grid, Apache Ignite

UP1: For complete quick start guide, see also the sample chapter of the book "High performance in-memory computing with Apache Ignite" here . Even you can find the sample examples from the GitHub repository . IMDG or In memory data grid is not an in-memory relational database, an NoSQL database or a relational database. It is a different breed of software datastore. The data model is distributed across many servers in a single location or across multiple locations. This distribution is known as a data fabric. This distributed model is known as a ‘shared nothing’ architecture. IMDG has following characteristics: All servers can be active in each site. All data is stored in the RAM of the servers. Servers can be added or removed non-disruptively, to increase the amount of RAM available. The data model is non-relational and is object-based.  Distributed applications written on the platform independent language. The data fabric is resilient, allowing non-disruptive au...