Ishant Garg
Ishant Garg

Reputation: 71

Error while building a maven multi module project in wso2

I am working on a POC using WSO2 micro integrator and I have created an multi maven project which contains EBS Artifacts, Composite App, Registry and Kubernetes Exporter. When I am tring to build the project using parent multimaven pom, I am getting below error:

[INFO] Building EmployeeInfo 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ EmployeeInfo ---
[INFO] Deleting /Users/ishantgarg/IntegrationStudio/deployment_workspace/POC_EmployeeInfo/EmployeeInfo/target/capp
[INFO] 
[INFO] --- wso2-esb-api-plugin:2.1.0:pom-gen (api) @ EmployeeInfo ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] POC_EmployeeInfo ................................... SUCCESS [  0.682 s]
[INFO] EmployeeInfo ....................................... FAILURE [  0.091 s]
[INFO] EmployeeInfoRegistry ............................... SKIPPED
[INFO] EmployeeInfoCompositeApplication ................... SKIPPED
[INFO] EmployeeInfoKubernetsExporter ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:37 min
[INFO] Finished at: 2020-04-29T10:11:25+02:00
[INFO] Final Memory: 27M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen (api) on project EmployeeInfo: Execution api of goal org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen failed: A required class was missing while executing org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen: javax/activation/DataSource
[ERROR] -----------------------------------------------------
[ERROR] realm =    extension>org.wso2.maven:wso2-esb-api-plugin:2.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/wso2-esb-api-plugin/2.1.0/wso2-esb-api-plugin-2.1.0.jar
[ERROR] urls[1] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[2] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.4/plexus-component-annotations-1.5.4.jar
[ERROR] urls[3] = file:/Users/ishantgarg/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[4] = file:/Users/ishantgarg/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[5] = file:/Users/ishantgarg/.m2/repository/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar
[ERROR] urls[6] = file:/Users/ishantgarg/.m2/repository/org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.jar
[ERROR] urls[7] = file:/Users/ishantgarg/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
[ERROR] urls[8] = file:/Users/ishantgarg/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
[ERROR] urls[9] = file:/Users/ishantgarg/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
[ERROR] urls[10] = file:/Users/ishantgarg/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[11] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar
[ERROR] urls[12] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.1/plexus-utils-2.0.1.jar
[ERROR] urls[13] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.capp/2.1.0/org.wso2.maven.capp-2.1.0.jar
[ERROR] urls[14] = file:/Users/ishantgarg/.m2/repository/org/apache/ws/commons/axiom/wso2/axiom/1.2.11.wso2v4/axiom-1.2.11.wso2v4.jar
[ERROR] urls[15] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.utils/2.1.0/org.wso2.maven.utils-2.1.0.jar
[ERROR] urls[16] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.core/2.1.0/org.wso2.maven.core-2.1.0.jar
[ERROR] urls[17] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.esb/2.1.0/org.wso2.maven.esb-2.1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: javax.activation.DataSource
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :EmployeeInfo

I have tried cleaning up my local repository and this application is contains just a REST API which responds with a success message. No Logics.

Also I have tried to download basic code snippets from the internet and tried to build them. I get the same error. Could it be something related to my maven configuration in my local computer?

Upvotes: 2

Views: 2335

Answers (2)

Arwed Mett
Arwed Mett

Reputation: 2750

Short answer: Stop using WSO2

Long answer: Since Java 9 the javax.activation library is not included in the JDK per default. Therefore you must add the following dependency to every plugin which needs the javax.activation library.

<dependencies>
    <dependency>
        <groupId>com.sun.activation</groupId>
        <artifactId>javax.activation</artifactId>
        <version>1.2.0</version>
    </dependency>
</dependencies>

Run maven. Read the error message to know which plugin needs the dependency. Add it as a dependency and do the same thing over and over again until no more plugins are left that require the javax.activation library.

E.g.

<plugin>
    <groupId>org.wso2.maven</groupId>
    <artifactId>wso2-general-project-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <version>1.2.0</version>
        </dependency>
    </dependencies>
</plugin>

In your error message the plugin name is wso2-esb-api-plugin

Upvotes: 0

Ishant Garg
Ishant Garg

Reputation: 71

I was facing this issue because of the java version used by the maven. I installed maven version 3.6.x using brew which found out to be using java 13 internally.

What I figured out is that maven build for wso2 projects does not work with java version higher than 8.

To fix this, I installed binary maven from apache's website and configured it to use java 8, as a result I was able to build maven multi module project successfully.

Upvotes: 5

Related Questions