Monday, February 10, 2014

Resolve activation Module not found issue in WSO2 ESB 4.8.0


When you were upgrading your WSO2 ESB pfrom 4.7.0 or older version to 4.8.0, you might notice the following issue.  Caused by: org.wso2.carbon.CarbonException: Axis Module not found for : activation-2.1.2

This error happens if you migrate the ESB_HOME/repository/deployment/server/servicemetafiles/ folder to the ESB 4.8.0 or a later version. The reason is that activation module is not shipped with ESB anymore, but the servicemetafiles from the older version might still contain references to activation module. Since ESB cannot find that module, it throws the following error, and the proxy service fails to deploy.

To resolve this issue, you have to edit the metafiles to remove references to activation module. There, you might notice, the references like follows. The version might differ.

         <module name="activation" version="2.1.2" type="engagedModules"/>

Simply remove this line from the metafile, and then the proxy services will deploy successfully. You can create a script to do this if you have several proxy services / axis2 services.



[2014-02-10 13:02:09,156] ERROR - PersistenceMetaDataDeployer Unable to handle service initialization. Service: myProxyService
org.wso2.carbon.core.persistence.PersistenceException: Unable to handle service initialization. Service: myProxyService
    at org.wso2.carbon.core.persistence.AbstractPersistenceManager.handleExceptionWithRollback(AbstractPersistenceManager.java:582)
    at org.wso2.carbon.core.persistence.ServicePersistenceManager.handleExistingServiceInit(ServicePersistenceManager.java:747)
    at org.wso2.carbon.core.persistence.file.deployer.PersistenceMetaDataDeployer.deploy(PersistenceMetaDataDeployer.java:96)
    at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
    at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
    at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
    at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
    at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
    at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
    at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
    at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:79)
    at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:124)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.wso2.carbon.CarbonException: Axis Module not found for : activation-2.1.2
    at org.wso2.carbon.core.persistence.AbstractPersistenceManager.getExistingAxisModule(AbstractPersistenceManager.java:562)
    at org.wso2.carbon.core.persistence.ServicePersistenceManager.handleExistingServiceInit(ServicePersistenceManager.java:472)
    ... 20 more

Saturday, February 1, 2014

Merge WSO2 Carbon products using Maven


It's a common requirement for users of WSO2 to combine multiple WSO2 products together everything can be run within one JVM instance. Because of component architecture of WSO2 Carbon, you can combine features from several into one product which would help some deployments. Some of the common products that get merged together are AS + DSS + BPS, ESB + IS, BAM + CEP. The default way to install products/features is to use the 'Feature Manager' in the management console. But users might want to merge products via Apache Maven. This is done by creating a maven pom.xml, and leveraging carbon-p2-plugin.

Following steps guide you on how to create merge features from different products together.

Pre-requisites -

Apache Maven 3.0.x and Apache Ant are required.

Steps -

  1.  Create a directory, and add the following in a file named pom.xml. Let's call this directory as $BASE_DIR
  2.  Download the P2-repo at http://dist.wso2.org/p2/carbon/releases/turing.tar.gz
  3.  Extract the turing.tar.gz to $BASE_DIR/p2-repo. Now, the content.jar should be located at $BASE_DIR/p2-repo/content.jar
  4.  Add the features you want additionally to the pom.xml. The sample contains two features - org.wso2.carbon.webapp.mgt.feature.group, and org.wso2.carbon.logging.mgt.feature.group. The feature listings should look like the following. The features needed for each product can be found under the p2-profile-gen/pom.xml. For ex. the AS features - https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/products/as/5.2.1/modules/p2-profile-gen/pom.xml
            <feature>
                <id>org.wso2.carbon.webapp.mgt.feature.group</id>
                <version>${carbon.platform.version}</version>
            </feature> 
    
  5. Enter the command `mvn clean install`
  6. Your combined product will be built at $BASE_DIR/target/wso2carbon-x.x.x.


    <?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">
    <parent>
        <groupId>org.wso2.appserver</groupId>
        <artifactId>wso2appserver-parent</artifactId>
        <version>5.2.0</version>
    </parent>
    
    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2product-p2-gen</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 Product Profile Generation</name>
    <url>http://wso2.org</url>
    
    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <inherited>false</inherited>
            <executions>
                <execution>
                    <id>1-unpack-p2-agent-distribution</id>
                    <phase>test</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.wso2.carbon</groupId>
                                <artifactId>wso2carbon-core</artifactId>
                                <version>${carbon.kernel.version}</version>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>target</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
                <execution>
                    <id>unpack-equinox-executable</id>
                    <phase>test</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.eclipse.equinox</groupId>
                                <artifactId>org.eclipse.equinox.executable</artifactId>
                                <version>3.5.0.v20110530-7P7NFUFFLWUl76mart</version>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>target</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>carbon-p2-plugin</artifactId>
            <version>${carbon.p2.plugin.version}</version>
            <executions>
              <execution>
                    <id>3-p2-profile-generation</id>
                    <phase>package</phase>
                    <goals>
                        <goal>p2-profile-gen</goal>
                    </goals>
                <configuration>
                    <profile>default</profile>
                    <metadataRepository>file:${basedir}/p2-repo</metadataRepository>
                    <artifactRepository>file:${basedir}/p2-repo</artifactRepository>
                    <destination>
                        ${basedir}/target/wso2carbon-core-${carbon.kernel.version}/repository/components
                    </destination>
                    <deleteOldProfileFiles>true</deleteOldProfileFiles>
                    <features>
                        <!-- ### Add your features here ### -->
                        <feature>
                            <id>org.wso2.carbon.logging.mgt.feature.group</id>
                            <version>${carbon.platform.version}</version>
                        </feature>
    
                        <feature>
                            <id>org.wso2.carbon.webapp.mgt.feature.group</id>
                            <version>${carbon.platform.version}</version>
                        </feature>
    
                    </features>
                </configuration>
              </execution>
    
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <configuration>
                        <tasks>
                            <replace token="false" value="true"
                                     dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components">
                                <include name="**/bundles.info"/>
                            </replace>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    </build>
    <properties>
       <carbon.platform.version>4.2.0</carbon.platform.version>
       <carbon.kernel.version>4.2.0</carbon.kernel.version>
    </properties>
    
    <repositories>
         <repository>
            <id>wso2-nexus</id>
            <name>WSO2 internal Repository</name>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
        </repository>
    </repositories>
    
    <pluginRepositories>
        <pluginRepository>
            <id>wso2-maven2-repository-1</id>
            <url>http://dist.wso2.org/maven2</url>
        </pluginRepository>
        <pluginRepository>
            <id>wso2-maven2-repository-2</id>
            <url>http://dist.wso2.org/snapshots/maven2</url>
        </pluginRepository>
     </pluginRepositories>
    </project>