Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Adding jars for a ServletFilter

I am running 6.0.3 on linux with the default liberty.
I'd like to add some Jar files for our SSO servlet filter agent.
I've tried putting them in the JTS_HOME/server/liberty/wlp/lib directory but it complains that it cannot find the filter class.
I've also tried putting them in the JTS_HOME/jre/lib/ext and endorsed directories, and while it sees the servlet filter classes, it cannot find the javax.servlet.Filter class.
[ERROR   ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: Filter [Cams Servlet Filter Web Agent]: com.cafesoft.security.webagent.servletFilter.CamsServletFilterWebAgent was found, but is missing another required class.

    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4913)
    at [internal classes]
Caused by: javax.servlet.ServletException: Filter [Cams Servlet Filter Web Agent]: com.cafesoft.security.webagent.servletFilter.CamsServletFilterWebAgent was found, but is missing another required class.

    at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:639)
    ... 1 more
Caused by: java.lang.NoClassDefFoundError: javax.servlet.Filter

Do I have to add the classes to each of the apps? Or is there a better place? Or is this not possible with this version of java?

0 votes



2 answers

Permanent link
Maybe the approach mentioned here?
http://stackoverflow.com/questions/35379315/create-a-servlet-filter-websphere-liberty-profile

0 votes

Comments

Thanks, that looks like it could be helpful but I'm missing a lot of background information. I'm trying to catch up. Would this be added into the server.xml, it has a featureManager block:
    <!-- Enable features -->
    <featureManager>
        <feature>monitor-1.0</feature>
  
        <feature>appSecurity-2.0</feature>
        <feature>adminCenter-1.0</feature>
    </featureManager>

While I parse and find out what I need to know, how about making classes shared from one app to another?
I was able to add the jars do the demo app and have liberty deploy it and verify it works. I was shown this link, but I don't think this liberty server has a console like shown.
Note, I deployed my demo app manually, should I have used the installUtility to add it?


Permanent link
Two more approaches you could try.
Adding global libraries to all applications: http://www.ibm.com/support/knowledgecenter/en/SSRTLW_8.5.5/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_classloader_global_libs.html

Using shared libraries:
http://www.ibm.com/support/knowledgecenter/en/SSRTLW_8.5.5/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/cwlp_sharedlibrary.html

0 votes

Comments

This looks very helpful!
I'm looking at the global libraries option--
So, my server.xml is mostly high-level protocol. The applications are defined in a conf/application.xml.
The applications are WARs not EARs, and do not have a classloader section already, so when I add this section, will I be breaking anything existing?
<server><library id="cams"><fileset dir="/opt/ibm/JazzTeamServer/lib" includes="*.jar" /></library>
<application type="war" id="jts" name="jts" location="${server.config.dir}/apps/jts.war">
<classloader apiTypeVisibility="spec" commonLibraryRef="cams" />
<application-bnd>
<security-role name="JazzAdmins">
                <group name="JazzAdmins" />
     </security-role>
... etc ....      </application-bnd>
    </application>

I received the following error trying simple setup above:
[ERROR   ] CWWKL0008E: Application [cams#cams.war] cannot use the common class loader for library [cams] because they have inconsistent API visibility configurations. Library [cams] is configured with [[spec, ibm-api, api]] and application [cams#cams.war] is configured with [[spec]].

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 7,496

Question asked: Jan 04 '17, 4:30 p.m.

Question was seen: 4,221 times

Last updated: Jan 05 '17, 1:51 p.m.

Confirmation Cancel Confirm