Topic
  • 3 replies
  • Latest Post - ‏2013-04-05T11:52:30Z by IsaacGraf
IsaacGraf
IsaacGraf
5 Posts

Pinned topic Classloading on startup

‏2013-04-04T18:54:47Z |
Thank you for your helpful responses to my query yesterday.
We are beginning work on porting our application from eWAS to Liberty Profile and I apologize for the newbie questions.

The issue I'm having now is when the application starts up (via a load-on-startup servlet) it is not able to find 3rd party libraries that I configured in server.xml (see below). I put the 3rd party jars in the dsa directory I hardcoded in the library property.
I'm wondering if I'm configuring it wrong or if maybe the classloading doesn't work during autostartup of the servlet?


<library id=
"dsa"> <fileset dir=
"/home/igraf/Liberty855/wlp/usr/servers/server1/lib/dsa" includes=
"*.jar" scanInterval=
"5s" /> </library>   <application id=
"nci"  name=
"NCI" type=
"ear" location=
"NCI_update.ear" > <classloader apiTypeVisibility=
"spec, ibm-api, third-party" commonLibraryRef=
"dsa" /> </application>   <webContainer deferServletLoad=
"false" />


Thanks very much,
Isaac
  • Tom_McManus
    Tom_McManus
    8 Posts

    Re: Classloading on startup

    ‏2013-04-04T19:58:02Z  
    Isaac --

    Try removing the apiTypeVisability. Is this library going to be shared across multiple apps?

    Thanks.
    Tom
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Classloading on startup

    ‏2013-04-04T21:55:10Z  
    Isaac --

    Try removing the apiTypeVisability. Is this library going to be shared across multiple apps?

    Thanks.
    Tom
    Hi,

    The startup setting should not have any effect on library availability.

    If the application or library code need visibility to third-party API packages then you need to have matching visibility attributes on the library and the application:

    <library id="dsa" apiTypeVisibility="spec, ibm-api, third-party">
    <fileset dir="/home/igraf/Liberty855/wlp/usr/servers/server1/lib/dsa" includes="*.jar" scanInterval="5s" />
    </library>

    <application id="nci" name="NCI" type="ear" location="NCI_update.ear" >
    <classloader apiTypeVisibility="spec, ibm-api, third-party" commonLibraryRef="dsa" />
    </application>

    if third-party API is not being used, you can simplify this:

    <library id="dsa">
    <fileset dir="/home/igraf/Liberty855/wlp/usr/servers/server1/lib/dsa" includes="*.jar" scanInterval="5s" />
    </library>

    <application id="nci" name="NCI" type="ear" location="NCI_update.ear" >
    <classloader commonLibraryRef="dsa" />
    </application>

    Hope this works!
    Regards, Alex.
  • IsaacGraf
    IsaacGraf
    5 Posts

    Re: Classloading on startup

    ‏2013-04-05T11:52:30Z  
    Hi,

    The startup setting should not have any effect on library availability.

    If the application or library code need visibility to third-party API packages then you need to have matching visibility attributes on the library and the application:

    <library id="dsa" apiTypeVisibility="spec, ibm-api, third-party">
    <fileset dir="/home/igraf/Liberty855/wlp/usr/servers/server1/lib/dsa" includes="*.jar" scanInterval="5s" />
    </library>

    <application id="nci" name="NCI" type="ear" location="NCI_update.ear" >
    <classloader apiTypeVisibility="spec, ibm-api, third-party" commonLibraryRef="dsa" />
    </application>

    if third-party API is not being used, you can simplify this:

    <library id="dsa">
    <fileset dir="/home/igraf/Liberty855/wlp/usr/servers/server1/lib/dsa" includes="*.jar" scanInterval="5s" />
    </library>

    <application id="nci" name="NCI" type="ear" location="NCI_update.ear" >
    <classloader commonLibraryRef="dsa" />
    </application>

    Hope this works!
    Regards, Alex.
    Thank you! that did the trick.