Topic
1 reply Latest Post - ‏2013-06-29T05:36:34Z by Steven Zou
coder_zhang
coder_zhang
1 Post
ACCEPTED ANSWER

Pinned topic Why my icap application can not run after I add an external library to the build path

‏2013-06-28T09:55:02Z |

Hi,

  I'm trying to develop a java web application using icap IDE.  It once worked well and my application could successfully running in the local sandbox environment. However, I encountered a strange problem. After I add an external jar library to the build path of the icap project, the project became broken. It could not be started and run in the local sandbox.  One classes in my added library can not be found. I have checked the build path of the icap project, no any problems existing, So I don't know why caused this.  Can anybody or icap experts here help me?The error log and screenshot have been attached.

Thanks in advanced!

Additionally, the added library is called in  the following code segment :

public String toJSON() {
        ObjectMapper om = new ObjectMapper();
        try {
            return om.writeValueAsString(this);
        } catch (Exception e) {
            return "{}";
        }
    }

Attachments

Updated on 2013-06-28T09:57:05Z at 2013-06-28T09:57:05Z by coder_zhang
  • Steven Zou
    Steven Zou
    2 Posts
    ACCEPTED ANSWER

    Re: Why my icap application can not run after I add an external library to the build path

    ‏2013-06-29T05:36:34Z  in response to coder_zhang

    Hi,

      The reason for this problem is that there is a limitation in the icap IDE technical preview version. When you create a new icap application(project) from the ide,  the ide will automatically generate a build script for the icap application. When the application is started, the ide will call the build script to compile and deploy the application instead of using the compile results generated by the project builder. Unfortunately the limitation is existing in the previous generated build. The build script just copy and pack the jar libraries located in the libs folder into the final application war file. So when application started, errors may occurred.

    To resolve this problem, there are to simple ways outlined in the following:

    Option 1: Put/Copy your external jar libraries into the libs folder under your project

    Option 2[Recommended]: You can follow the below steps to complete your customized library configuration:

    • Open the icap java preference page by clicking window->preferences->ICAP->Java
    • Make the check box "Enable service management in IDE" CHECKED

    Open preferences page

    • Click the sub menu item "Component Libraries" of the "Java" item to open the component library management page
    • Right click the "Customized Component" to open the "New extension library" dialog and then input a library name such as "Json Libraries"
    • Right Click the new added library node to open the "Add external JAR/JS" dialog, in the file browser, located your jar library files you want to added and click ok. Then library files are added into your customized component.
    • For each library file, you can right click and open the configuration dialog. Each library file can be configured to three different levels:
    1. Application level: The library file will be added to the project build path as well as packed into the final application WAR file
    2. Project level: The library file will only be added to the project build path and will NOT be packed into the final application WAR file
    3. Container level: [NOT Applied in customized component] The application container will provided the related library, the library file will NOT be added to build path as well as NOT packed into the final package.
    • When you finished doing all the above steps , click the "Apply" or "Finish" button to make it effective.

     

    How to configure customized library

     

    • Right click the your project in the project explorer to open the context menu, click the "Extend Project" item and the project extension wizard will be opened
    • Select your added customized library in the left panel of the project extension wizard and click the "Add" button to move it from the left to the right panel which is the configured components in the project
    • Click "Next" and "Finish" button to complete the left steps of the wizard
    • After doing this, the library will be added to the project build path and copied into the libs folder automatically

     

    Add customized library to icap project

     

    The option 2 seems a little complex, but it's an easy way to manage your customized library and make them under your and IDE's control and also can largely avoid the unknown problem.

    If you still have problems or other issues, welcome to post them here. Thanks. 

    Updated on 2013-06-29T05:51:06Z at 2013-06-29T05:51:06Z by Steven Zou