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

Send e-mail with attachment through OSB

Oracle Service Bus (OSB) contains a good collection of adapter to integrate with any legacy application, including ftp, email, MQ, tuxedo. However e-mail still recognize as a stable protocol to integrate with any application asynchronously. Send e-mail with attachment is a common task of any business process. Inbound e-mail adapter which, integrated with OSB support attachment but outbound adapter doesn't. This post is all about sending attachment though JavaCallout action. There are two ways to handle attachment in OSB: 1) Use JavaCallout action to pass the binary data for further manipulation. It means write down a small java library which will get the attachment and send the e-mail. 2) Use integrated outbound e-mail adapter to send attachment, here you have to add a custom variable named attachment and assign the binary data to the body of the attachment variable. First option is very common and easy to implement through javax.mail api, however a much more developer manage t

Tip: SQL client for Apache Ignite cache

A new SQL client configuration described in  The Apache Ignite book . If it got you interested, check out the rest of the book for more helpful information. Apache Ignite provides SQL queries execution on the caches, SQL syntax is an ANSI-99 compliant. Therefore, you can execute SQL queries against any caches from any SQL client which supports JDBC thin client. This section is for those, who feels comfortable with SQL rather than execute a bunch of code to retrieve data from the cache. Apache Ignite out of the box shipped with JDBC driver that allows you to connect to Ignite caches and retrieve distributed data from the cache using standard SQL queries. Rest of the section of this chapter will describe how to connect SQL IDE (Integrated Development Environment) to Ignite cache and executes some SQL queries to play with the data. SQL IDE or SQL editor can simplify the development process and allow you to get productive much quicker. Most database vendors have their own front-en

Load balancing and fail over with scheduler

Every programmer at least develop one Scheduler or Job in their life time of programming. Nowadays writing or developing scheduler to get you job done is very simple, but when you are thinking about high availability or load balancing your scheduler or job it getting some tricky. Even more when you have a few instance of your scheduler but only one can be run at a time also need some tricks to done. A long time ago i used some data base table lock to achieved such a functionality as leader election. Around 2010 when Zookeeper comes into play, i always preferred to use Zookeeper to bring high availability and scalability. For using Zookeeper you have to need Zookeeper cluster with minimum 3 nodes and maintain the cluster. Our new customer denied to use such a open source product in their environment and i was definitely need to find something alternative. Definitely Quartz was the next choose. Quartz makes developing scheduler easy and simple. Quartz clustering feature brings the HA and