Thursday, January 30, 2014

How to resolve WSO2 platform build failures come due to package does not exist

You can follow the steps on building Carbon by the link below :

http://docs.wso2.org/display/Carbon420/Building+from+Source

Following blog post is for the users who have fair knowledge in programming. Intended users will be Quality Assurance Engineers.

How to Isolate :

1. First of all, to isolate the problems you face, it is better to start building according to the modules defined in the pom.xml.

E.g.,

Open the pom.xml in ../platform/branches/turing/product-releases/chunk-07

You will see the modules defined like below.

             <modules>
                <module>dependencies</module>
                <module>service-stubs</module>
                <module>components</module>
                <module>platform-integration/test-automation-framework</module>
                <module>features</module>
                <module>products</module>
                <module>platform-integration/platform-automated-test-suite</module>
             </modules>

Build one by one by the following command.

mvn clean install --fail-at-end
fail-at-end will be used to continue the all modules bulding eventhough there is a build failure.


2. Imagine when you are building products you get an error like below.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sample-utils: Compilation failure: Compilation failure:
[ERROR] /home/ushani/Downloads/Automation_TC/24_Jan_2014/turing/products/bps/3.2.0/modules/samples/product/sample-utils/src/main/java/org/wso2/bps/samples/util/PasswordEncryptUtil.java:[23,31] package org.apache.axiom.om.util does not exist
[ERROR] /home/ushani/Downloads/Automation_TC/24_Jan_2014/turing/products/bps/3.2.0/modules/samples/product/sample-utils/src/main/java/org/wso2/bps/samples/util/PasswordEncryptUtil.java:[58,66] package org.bouncycastle.jce.provider does not exist
[ERROR] /home/ushani/Downloads/Automation_TC/24_Jan_2014/turing/products/bps/3.2.0/modules/samples/product/sample-utils/src/main/java/org/wso2/bps/samples/util/PasswordEncryptUtil.java:[84,35] cannot find symbol
[ERROR] symbol  : variable Base64
[ERROR] location: class org.wso2.bps.samples.util.PasswordEncryptUtil
[ERROR] -> [Help 1]
[ERROR] Failed to execute goal org.wso2.maven:carbon-p2-plugin:1.5.3:p2-repo-gen (3-p2-repo-generation) on project wso2-bps-profile-gen: Error occured when processing the Feature Artifact: org.wso2.bps:org.wso2.bps.samples.utils.feature:3.2.0: ERROR: Failure to find org.wso2.bps:org.wso2.bps.samples.utils.feature:zip:3.2.0 in http://maven.wso2.org/nexus/content/groups/wso2-public/ was cached in the local repository, resolution will not be reattempted until the update interval of wso2-nexus has elapsed or updates are forced
[ERROR]

Identify the error, the affected place and the reason :
3. If you look at it properly, you see the error is in PasswordEncryptUtil.java class.
4. So the best thing is open the project in idea. from sample-utils/src/main/java/org/wso2/bps/samples onwards.
5. you will see the class name with a red curly underline since there is an error in the class.
6. Go to the class and check what is wrong in it. As per the above error, issue was with the symbol
variable Base64
7. In the code the following line was in red, exposing it as an error.

  String encodedString = Base64.encode(encryptedText);
8. Also there was another curly line in red mentioning the following import hasnt been done correctly.
import org.apache.axiom.om.util.Base64;

Solutions :

Solution 1.
a. Either you can check in you .m2 , which is also known as the maven repository in your machine.
.m2 is a repository that is created in every one of your machine, if you have installed maven properly. Whenever you need  any dependencies, it will automatically download in to your maven repository.
You can see your maven repo at the following place :
/home/<username>/.m2

b. Go to .m2 and follow the import path correctly in the file location.
E.g.,
 You should have a folder called axiom in the following file location.

/home/ushani/.m2/repository/org/apache
c. if you don't have a folder that means the issue is because it hasn't been downloaded properly. You can get it from someone else's .m2 repo and replace you one or can check from which location it has been taken. Sometimes axiom folder can be refereed from a different location.
if so you will have to provide the dependency manually in you pom.xml located in the related module.
E.g., I had the issue in sample-utils. So I will refer the pom.xml in that module.

/home/ushani/Downloads/Automation_TC/24_Jan_2014/turing/products/bps/3.2.0/modules/samples/product/sample-utils/pom.xml.
According to this the correct axiom is inside,

path : /home/ushani/.m2/repository/org/apache/ws/commons/axiom

Add the following dependency according to the correct location.

<dependency>
            <groupId>org.apache.ws.
commons.axiom</groupId>
            <artifactId>axiom-api</
artifactId>
            <version>1.2.8</version>
        </dependency>    
<dependency>
            <groupId>org.apache.ws.
commons.axiom</groupId>
            <artifactId>axiom-impl</
artifactId>
            <version>1.2.8</version>
    </dependency>

Solution 2:
1. Go near the issue underlined in red colour and get the your curosr top of it and the help comes in the left corner of your code editor window.
It will give you suggestions.

If there is a missing maven dependency it will ask whether to add. You have to click that suggestion and provide the correct path which will come automatically.

By this it will solve the problem and that dependency will be added in to your pom.xml automatically.

9 comments:

  1. This is also a very good post which I really enjoy reading. It is not everyday that I have the possibility to see something like this. custom pool builder spicewood tx

    ReplyDelete
  2. Thanks for the information. Must necessary to share this blog . This will help to get full knowledge on how to BUY DELTA 8 THC DISTILLATE ONLINE and help also for our coming future.

    For more infor.
    EMAIL......support@420labextracts.com

    TEXT/CALL/WHATSAPP....
    +1(424) 235 3914

    ReplyDelete
  3. I need to to thank you for this great read!! I definitely loved every bit of it.
    EVERYTHING YOU NEED TO KNOW ABOUT BLUE COOKIES STRAIN I have got you bookmarked to look at new stuff you

    ReplyDelete
  4. Hello

    Have some useful information i will like to shear with you about thca isolate read more.


    For more details...

    cotact: +1 (424) 235-3914

    EMAIL: support@420labextracts.com

    website: 420labextracts.com

    ReplyDelete
  5. Thanks for shearing such a useful content about pure thca diamond myself being a user of thca isolate for decades now, have got some useful articles and contents i will like to update you with
    buy thca isolate online...

    ReplyDelete
  6. Very interesting! this blog is very helpful for someone like me who have been doing researchwork on THCA ISOLATE powder.
    We have some important articles and contents about pure thca diamond. read more...


    website: 420labextracts.com
    contact: +1 (424) 235-3914

    ReplyDelete
  7. Thanks for shearing this article about THCA ISOLATE, chech out some of our must important contentss about this product read more...

    read more

    ReplyDelete
  8. Thanks for the wonderful informations about ,Thca isolate powder, We have quality content that will help you and your audience , read more,

    ReplyDelete
  9. Hi thanks for the wonderful information regarding ,Thca isolate powder, we have interesting article which do you and your audience about more ionformation regarding the above mentioned , find more,



    Call or text >>>>>+1(505)257-5355

    Email>>>>>>>>>>support@legal420isolate.com

    ReplyDelete