Re: Recognizing JAR files in WEB-INF/lib

Steven Vetzal wrote:
I am attempting to open existing web projects in NitroX and am beingplagued with:
The class "com.someone.Class" is not in the application class path
The classes are contained in JAR files in WEB-INF/lib.
I have been looking for a way to add these JAR files to the classpath.
There is no builder registered, so I'm not sure I can even get there
from here :)
Don't you love it when people answer their own questions?
Here's what I did:
Add the following sections to the .project file-
Under BuildSpec:
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
Under natures:
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.m7.nitrox.webProjectNature</nature>
This fixed up all my classpath issues - after I modified the Java
classpath of course... For example, my .classpath file looks like:
<classpathentry kind="src" path="WEB-INF/classes"/>
<classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/>
<classpathentry kind="con" path="J2ee.runtime.m7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/>
<classpathentry kind="output" path="WEB-INF/classes"/>
I found that by examining these files from other projects (like from the
web project wizard) it was easy to find out what my broken project was
missing.
Hopefully this will help someone else one day :)
Steve

Hi Steven,
Sorry for the late response, next time you can do this in a more simple way
by launching Properties window (right click on project) and select Java
Build Path, click on Libraries tab.
Thanks
M7 Support
"Steven Vetzal" <[email protected]> wrote in message
news:[email protected]..
Steven Vetzal wrote:I am attempting to open existing web projects in NitroX and am being
plagued with:
The class "com.someone.Class" is not in the application class path
The classes are contained in JAR files in WEB-INF/lib.
I have been looking for a way to add these JAR files to the classpath.
There is no builder registered, so I'm not sure I can even get there from
here :)
Don't you love it when people answer their own questions?
Here's what I did:
Add the following sections to the .project file-
Under BuildSpec:
buildCommand
name>org.eclipse.jdt.core.javabuilder</name
arguments
/arguments
/buildCommand
Under natures:
nature>org.eclipse.jdt.core.javanature</nature
nature>com.m7.nitrox.webProjectNature</nature
This fixed up all my classpath issues - after I modified the Java
classpath of course... For example, my .classpath file looks like:
classpathentry kind="src" path="WEB-INF/classes"/
classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/
classpathentry kind="con" path="J2ee.runtime.m7"/
classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/
classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/
classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/
classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/
classpathentry kind="output" path="WEB-INF/classes"/
I found that by examining these files from other projects (like from the
web project wizard) it was easy to find out what my broken project was
missing.
Hopefully this will help someone else one day :)
Steve

Similar Messages

  • Jar file in web-inf\lib is not being loaded - weblogic 7.0

    I am callling a webservice from a jsp. everything works fine if I keep the interface
    classes under web-inf\classes....but If I put the interface classes in a jar file
    and put it under web-inf\lib, then weblogic does not seem to find that....
    I am getting following error :
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):14:
    class CustomerValue is public, should be declared in a file named CustomerValue.java
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):119:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):120:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):121:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    4 errors
    Wondering if it is a bug...?
    any thoughts ?
    -Girish Bhatia

    I wrote up a simple test case for this and it works fine for me.
    I suppose there are diffences. ;)
    I am using:
    WebLogic Server 7.0 SP1 Mon Sep 9 22:46:58 PDT 2002 206753
    Take the attached zip, unzip.
    cd to directory
    ant build
    then deploy it via the console, or
    java weblogic.Deployer -adminurl t3://127.0.0.1:7001 -user weblogic -password
    weblogic -activate -name mywebapp2 -source e:/weblogic/dev/sandbox/griffith/apps/output/exploded_mywebapp_lib/
    Then:
    http://c863775-d:7001/exploded_mywebapp_lib/frobber
    works for me. My servlet implments an interface in the jar in my lib dir.
    Cheers
    mbg
    "Girish" <[email protected]> wrote:
    >
    I am callling a webservice from a jsp. everything works fine if I keep
    the interface
    classes under web-inf\classes....but If I put the interface classes in
    a jar file
    and put it under web-inf\lib, then weblogic does not seem to find that....
    I am getting following error :
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):14:
    class CustomerValue is public, should be declared in a file named CustomerValue.java
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):119:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):120:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\_appsdir_omccs_example_war_omccs_example_4653011\jarfiles\WEB-INF\lib\Customer_client32432.jar(com/qwest/omccsexample/ejb/CustomerBean/CustomerValue.java):121:
    cannot resolve symbol
    symbol : class RuntimeUtils
    location: package binding
    (source unavailable)
    4 errors
    Wondering if it is a bug...?
    any thoughts ?
    -Girish Bhatia
    [mywebapptest.zip]

  • Weblogic Server not picking the jar files in WEB-INF/lib folder

    we are facing a strange problem where Weblogic App Server is not picking the jar files present inside the WEB-INF/lib folder if we update the jar file path in the classpath of the start script then the classes get loaded properly.
    Is there any specific setting which I need to do in weblogic to pick these jars ?

    Class loaders associated with a Web application can be configured to locate local classes first. To enable this we have to set the <prefer-web-inf-classes> to true in the deployment override weblogic.xml, for example
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    http://blog.transfer-solutions.com/2010/12/weblogic-class-loading/

  • JAR files under WEB-INF but not in lib directory

    I am working with JDeveloper 10g and I have several jar files under WEB-INF/lib and other under WEB-INF/libEst.
    I have add this libraries to Project properties > Paths and it works fine when I run my aplication in local environment, but it fails when I deploy and run in the server.
    I have configured our deploy file to include these WEB-INF/libEst jar files, but when I deploy to our server, it seems to be that this classes included in these jar files are not reachable and they cannot be loaded and throw a ClassNotFoundException.
    Is it possible to have jar files under any WEB-INF subdirectory distinct of /lib?
    Why is it working in local but not in server?
    If someone can help me to configure this in order to deploy in server, I will be very grateful.
    Thanks a lot,
    Antonio.

    Hi Antonio,
    I think this document is what you are looking for: http://www.oracle.com/technology/tech/java/oc4j/htdocs/how-to-servlet-warmanifest.html
    .. your manifest entries would look like
    Class-Path: WEB-INF/libExt/<jarName1>.jar, WEB-INF/libExt/<jarName2>.jar, ...
    Let me know if this works for you.
    thanks,
    Harsha

  • Tomcat6 does not load class files from WEB-INF/lib/myjarfile.jar  WHY???

    I have placed my jar file in c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jar
    But, after restarting tomcat6, when i try to import the class file contained in the myjarfile.jar in a servlet, it says
    ProcessFileUpload.java:4: package test.test1 does not exist
    import test.test1.*;
    ^It clearly tomcat's class loading problem.
    As i unzipped my jar and placed the packagefolder structure to
    c:\tomcat6\webapps\my-application\WEB-INF\classes\testand it works perfectly.
    Anyone knows its workaround? please suggest if any configuration changes is required in tomcat or so.
    Thanks.
    ---Sujoy

    Thank you gimbal2 . There was error in creating the jar file myjarfile.jar.
    But, now I have created it again and placed it in place
    c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jarand tried to use one on the Class file included within the jar to compile my servlet. But, still I am getting error at servlet compilation time. I want to place executable jar files in
    c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jar and compile my servlet and execute the servlet.
    I DO NOT WANT TO unzip the jar, placing all unzipped files to
    c:\tomcat6\webapps\my-application\WEB-INF\classes\ folder and comiple my servlet and execute the servlet. But, I am failing to user WEB-INF\lib\ folder facility....please help me why i am not getting class files from WEB-INF\lib\ folder.
    If you please see the small code bit and tell me any possible error that would be very helpful.
    Step 1: my library java file MyClass.java
    package test.test1;
    public class MyClass {
         String myName = "Default return string value";
         public void setMyName(String varName) {
              this.myName = varName;
         public String getMyName() {
              return this.myName;
    }Step2 : Creating jar file of my library class files
    C:\jdk1.6\bin>jar cvf myjarfile.jar test
    added manifest
    adding: test/(in = 0) (out= 0)(stored 0%)
    adding: test/test1/(in = 0) (out= 0)(stored 0%)
    adding: test/test1/MyClass.class(in = 452) (out= 296)(deflated 34%)
    adding: test/test1/MyClass.java(in = 230) (out= 140)(deflated 39%)
    C:\jdk1.6\bin>Step3 : Double checking the created jar file content by listing its content
    C:\jdk1.6\bin>jar tf myjarfile.jar
    META-INF/
    META-INF/MANIFEST.MF
    test/
    test/test1/
    test/test1/MyClass.class
    test/test1/MyClass.java
    C:\jdk1.6\bin>Step4 : Placed myjarfile.jar to
    c:\tomcat6\webapps\my-application\WEB-INF\lib\Step5 : Restarted standalone Tomcat6 in my Windows XP SP2.
    Step6 : Created a simple servlet LibFolderTest.java within my-application\WEB-INF\classes\ folder with code
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import test.test1.*;
    public class LibFolderTest extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              MyClass mc = new MyClass();
              out.println(mc.getMyName());
    }Step7 : Tried to compile my servlet LibFolderTest.java and got the following error
    LibFolderTest.java:4: package test.test1 does not exist
    import test.test1.*;
    ^
    LibFolderTest.java:11: cannot find symbol
    symbol  : class MyClass
    location: class LibFolderTest
                    MyClass mc = new MyClass();
                    ^
    LibFolderTest.java:11: cannot find symbol
    symbol  : class MyClass
    location: class LibFolderTest
                    MyClass mc = new MyClass();
                                     ^
    3 errorsThe above servlet compilation error on Step7 is telling me that myjarfile.jar is not loaded by Tomcat6 or not available for use when compiling servlet. I want to use myjarfile.jar from within WEB-INF\lib\ folder but I can not. please help.
    ---Sujoy

  • Jars extracted from WEB-INF/lib in JDev 9.0.3

    I have a project for a Web application with Struts and I've built a deployment profile for it. When I deploy to WAR or EAR the generated WAR contains the jars from <HTML Source>/WEB-INF/lib folder as extracted classes in the WEB-INF/classes folder and jars in WEB-INF/lib as well. I want to do something so that the jars will be included just as jars and not extracted.
    Thanks for help.

    I put the jars in the deployment profile in the "WAR File" option from deployment profile descriptor.
    When the jars were defined in a separate library entry for my project I put them through "WEB-INF/lib" link under "WAR File" option. Both ways it did the same.
    I gave up this and I am using ant but I would like to know if it is possible to do it with deployment descriptor.

  • Unable to load classes from jar files inside APP-INF/lib in EAR.

    Weblogic version: 10.3.3
    Platform: Linux x86-64 bit
    We deployed an ear packaged with all the common library jars inside APP-INF/lib. Deployment was successful.
    for some reason, it is always giving ClassNotFoundException for the classes inside the jars. This does not happen
    in 10.3.2 version of weblogic.
    We tried to add them to domain/lib directory (instead of APP-INF/lib) but still it is not able to resolve the classes.
    Any pointers would be appreciated.

    try using prefer-web-inf-classes in the weblogic.xml file in your WAR file
    or using prefer-application-packages in the weblogic-application.xml file in your EAR.

  • NoClassDefFoundError with jar in WEB-INF/lib

    Hi,
    I have an enterprise application running on Websphere 6. I have one external jar file in WEB-INF\lib (it's commons-lang). I am getting NoClassDefFoundError when trying to use classes in this jar file from the web app -- I thought that it was sufficient to drop the jar in \lib and then it would be picked up but obviously that is not the case.
    As a workaround, I've created a shared lib on the app server for this jar, and added it to the application. This works fine, but I can't understand why is should be required.
    Shouldn't it be sufficient just to put the jar file in WEB-INF\lib under the webapp?

    I think Websphere 6 already includes commons-logging. So the error you are getting may be classloader confusion, which is easy to do with Websphere and hard to understand (so I may be confused here). Try not including it anywhere, not in your web app and not whatever it was you did to make it work. Restart Websphere and your web app and see what happens.

  • WLS 8.1 SP4 and web-inf/lib ClassNotFoundExceptions

    Hi
    Is anyone else having problems with this issue ?
    I saw it was resolved (CR161884 & CR173695) in the 8.1 SP3 release, but I'm unable to deploy a web app (either through the console or in the applications directory of the domain) in SP4 as the classloader can't see my JAR file in WEB-INF/lib.
    <30-Dec-2004 15:51:47 o'clock GMT> <Error> <Deployer> <BEA-149201> <Failed to co
    mplete the deployment task with ID 7 for the application appsdirdp-application
    -1.0-SNAPSHOT_war.
    weblogic.management.DeploymentException:
    Exception:weblogic.management.ApplicationException: start() failed.
            Module: dp-application-1.0-SNAPSHOT     Error: weblogic.management.Deplo
    ymentException: org/picocontainer/gems/StaticFactory - with nested exception:
    [java.lang.NoClassDefFoundError: org/picocontainer/gems/StaticFactory]Inside my WAR file, I have a WEB-INF\lib directory, containing picocontainer-gems-1.1-SNAPSHOT.jar which contains the org.picocontainer.gems.StaticFactory class.
    I've tried deploying the app both with and without a weblogic.xml file declaring prefer-web-inf-classes set to true.
    Rgs
    Erik

    Just as a check, I moved the JAR files to a common lib directory on the server and added them to the system classpath specified in startWeblogic.cmd, and the application starts fine.
    Maybe not related, but yesterday I was tried deploying an EJB that was dependent on a JAR file NOT included within its JAR file, but specified with the Class-path entry in the manifest.
    The behaviour I saw was WLS swallowed the ClassNotFoundException silently, the admin console reported that the EJB was deployed successfully but inside the ejbCreate method - I had two print line statements, one prior to calling the missing class, and one after. Only the one prior appeared on the system console, suggesting that the ejbCreate method wasn't completing, yet no exception is thrown ?

  • Log4J - reading properties file from /WEB-INF directory issue..

    I'm just learning to implement Log4J; the approach I am taking for my JSF application running under Tomcat 5.5x is to create an initialization servlet to initialize the logger, and then access the logger instance within my backing beans and application module services. I include log4j.jar file in /WEB-INF/lib and log4j.properties in /WEB-INF.
    First I wanted to see if this was a good approach, and secondly I'm having trouble accessing the log4j.properties file from the /WEB-INF directory (see below) - any suggestions on how to set up the path so that the properties file can be found (I receive a java.io.filenotfoundexception)?
    Where I'm looking for direction is how to define a single instance of the logger and then access that instance from my java classes versus re-creating the logger in each class.
    ----- web.xml --------
    <servlet>
    <servlet-name>LogServlet</servlet-name>
    <servlet-class>com.sidehire.view.util.LogServlet</servlet-class>
    <init-param>
    <param-name>setup</param-name>
    <param-value>/WEB-INF/log4j.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    ------ LogServlet class ------
    public void init()
    throws ServletException {
    String config = getInitParameter("setup");
    PropertyConfigurator.configure(config);
    Thanks
    Message was edited by:
    javaX

    Try to put the log4j.properties in your WEB-INF/classes/ directory.
    You could wrap one log4j instance in a static method in a utility class, but then you would probably lose other information depending on your logger configuration.
    If you create an instance in each class, which after all is just one line like this:
    static Logger logger = Logger.getLogger(ChangePasswrdAction.class.getName());
    then you are able to get time and method information.

  • Jars in web-inf/lib not in classpath

              Hello,
              I am building a web application where I wish to use third party jars.
              (specifically cos.jar and log4j.jar)
              AFAIK when you place these jars in the web-inf/lib directory of your application
              they should then be included in the application classpath.
              However this does not seem to always work. I am using Weblogic 6.1, no service
              pack.
              Eventually I got it to work by adding a manifest to my EJB jar file with the classpath
              pointing to the jars and including the jars in the ear file.
              Has anyone else had any issues with this?
              Thanks,
              James
              

    James,
              Yes, I've had troubles with WLS 6.1.2 finding the classes in my jar files
              that are stored in WEB-INF/lib when deploying as a .war file. The funny
              thing is that when I deploy to a WLS 6.1.0 running on two other machines
              (one solaris, one linux), I don't see this problem.
              My servlets all extend the webmacro WMServlet class, which is found in
              WEB-INF/lib/webmacro.jar. When deploying my web app, grems, I see the
              following behavior.
              On WLS 6.1.0 (running on solaris), the server unjars the WEB-INF/lib files into
              ".wlnotdelete/WEB-INF/_tmp_war_myserver_myserver_grems". That directory
              contains a jar file for each one in my .war files WEB-INF/lib directory.
              On WLS 6.1.2 (running on Solaris), however, the server just doesn't seem to do that.
              Instead, it creates
              ".wlnotdelete/WEB-INF/_tmp_war_myserver_myserver_grems/WEB-INF/lib". Not
              only that, but it doesn't put any of my jar files into that directory.
              Notice that it create the WEB-INF directory twice for some reason.
              Needless to say, any class which uses a class from one of those jar files
              bombs spectacularly with a ClassNotFound exception. This is extremely
              frustrating and any help would be greatly appreciated.
              Thanks,
              Bobby
              In article <[email protected]>, "James Lawless"
              <[email protected]> wrote:
              > Hello,
              >
              > I am building a web application where I wish to use third party jars.
              > (specifically cos.jar and log4j.jar)
              >
              > AFAIK when you place these jars in the web-inf/lib directory of your
              > application they should then be included in the application classpath.
              >
              > However this does not seem to always work. I am using Weblogic 6.1, no
              > service pack.
              >
              > Eventually I got it to work by adding a manifest to my EJB jar file with
              > the classpath pointing to the jars and including the jars in the ear
              > file.
              >
              > Has anyone else had any issues with this?
              >
              > Thanks,
              >
              > James
              

  • MySql driver not found in WEB-INF/lib

    Hello
    This topic is very often met on this forum but there are no
    suitable answers for the problem I have. I am creating
    a Jsf application and I have setup a connection pool using
    the MySql jar. I want to supply the jar with the war and I keep
    it in WEB-INF/lib directory but I still get ClassNotFoundException.
    I am running this on a Debian machine with Sun JVM 1.5,
    Tomcat 5.0, Mysql 4.1, Connector/J - nightly build from
    20060403 (since the stable version has bugs with Charset).
    Here are the confings. If I missed some of them, pleaste tell
    me.
    War task in build.xml
        <target name="war" depends="build">
          <mkdir dir="${build.dir}"/>
          <war
            basedir="${webroot.dir}"
            warfile="${build.dir}/${project.distname}.war"
            webxml="${webinf.dir}/web.xml">
            <metainf dir="${meta.dir}">
              <include name="context.xml"/>
            </metainf>
            <exclude name="WEB-INF/${build.dir}/**"/>
            <exclude name="WEB-INF/src/**"/>
            <exclude name="WEB-INF/web.xml"/>
          </war>
        </target>
    context.xml
    <Context  path="/jsfblog" docBase="jsfblog.war" reloadable="false" crossContext="true" useNaming="true">
      <Resource name="jdbc/jsfblog" auth="Container" type="javax.sql.DataSource"/>
      <ResourceParams name="jdbc/jsfblog">
        <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
          <name>url</name>
          <value>jdbc:mysql://localhost/jsfblog</value>
        </parameter>
        <parameter>
          <name>driverClassName</name><value>com.mysql.jdbc.Driver</value>
        </parameter>
        <parameter>
          <name>username</name>
          <value>blog</value>
        </parameter>
        <parameter>
          <name>password</name>
          <value>blog</value>
        </parameter>
        <parameter>
          <name>maxWait</name>
          <value>3000</value>
        </parameter>
        <parameter>
          <name>maxIdle</name>
          <value>100</value>
        </parameter>
        <parameter>
          <name>maxActive</name>
          <value>10</value>
        </parameter>
      </ResourceParams>
    </Context>
    hibernate.cfg.xml
    <hibernate-configuration>
        <session-factory>
            <property name="connection.datasource">java:comp/env/jdbc/jsfblog</property>
            <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
            <property name="current_session_context_class">thread</property>
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
            <property name="show_sql">true</property>
            <mapping resource="......"/>
        </session-factory>
    </hibernate-configuration>
    web.xml
    I am not sure if I really need this.
    <web-app>
      <!-- Connection pool configuration  -->
      <resource-ref>
        <description>JSF Blog Database</description>
        <res-ref-name>jdbc/jsfblog</res-ref-name>
        <res-ref-type>javax.sql.DataSource</res-ref-type>
        <res-auth>Container</res-auth>
      </resource-ref>
      <!--  jsf and facelets declarations  -->
    jsfblog.policy
    Not all the rules apply at the same time. I also tried to
    setup the mysql jar in ${catalina.home}/common/lib
    directory and it was loaded but I need to make it work
    in WEB-INF/lib location.
    grant
         permission java.io.FilePermission "${catalina.home}/webapps/jsfblog/WEB-INF/lib/mysql-connector-java-3.1.12-bin.jar", "read";
         permission java.io.FilePermission "${catalina.home}/webapps/jsfblog/WEB-INF/lib/mysql-connector-java-3.1-nightly-20060403-bin.jar", "read";
         permission java.net.SocketPermission "localhost:3306", "connect,resolve";
    grant codeBase "jar:file:${catalina.home}/webapps/jsfblog/WEB-INF/lib/hibernate3.jar!/-" {
         permission java.lang.RuntimePermission "accessDeclaredMembers";
         permission java.util.PropertyPermission "*", "read,write";
         permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    grant codeBase "jar:file:${catalina.home}/webapps/jsfblog/WEB-INF/lib/mysql-connector-java-3.1-nightly-20060403-bin.jar!/-"
         permission java.net.SocketPermission "localhost:3306", "connect,resolve";
         permission java.lang.RuntimePermission "accessDeclaredMembers";
         permission java.util.PropertyPermission "*", "read,write";
         permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    Project layout
    |-- build
    |   `-- jsfblog.war
    |-- build.xml
    |-- conf
    |   `-- 99jsfblog.policy
    |-- deploy
    |   `-- jsfblog.war
    |-- doc
    |   |-- WEB-INF
    |   |   |-- classes
    |   |   |   |-- beans
    |   |   |   |   `-- CategoryBean.class
    |   |   |   |-- blog
    |   |   |   |   |-- Category.class
    |   |   |   |   |-- Category.hbm.xml
    |   |   |   |   |-- Comment.class
    |   |   |   |   |-- Comment.hbm.xml
    |   |   |   |   |-- Post.class
    |   |   |   |   `-- Post.hbm.xml
    |   |   |   |-- hibernate.cfg.xml
    |   |   |   |-- log4j.properties
    |   |   |   `-- util
    |   |   |       |-- HibernateSessionFactory.class
    |   |   |       |-- HibernateUtil.class
    |   |   |       `-- Service.class
    |   |   |-- faces-config.xml
    |   |   |-- lib
    |   |   |   |-- antlr-2.7.5.jar
    |   |   |   |-- asm-attrs.jar
    |   |   |   |-- asm.jar
    |   |   |   |-- cglib-2.1.3.jar
    |   |   |   |-- common-annotations.jar
    |   |   |   |-- commons-beanutils.jar
    |   |   |   |-- commons-collections-2.1.1.jar
    |   |   |   |-- commons-digester.jar
    |   |   |   |-- commons-lang.jar
    |   |   |   |-- commons-logging-1.0.4.jar
    |   |   |   |-- commons-validator.jar
    |   |   |   |-- dom4j-1.6.1.jar
    |   |   |   |-- el-api.jar
    |   |   |   |-- el-ri.jar
    |   |   |   |-- hibernate3.jar
    |   |   |   |-- jsf-api.jar
    |   |   |   |-- jsf-facelets.jar
    |   |   |   |-- jsf-impl.jar
    |   |   |   |-- jsf-tlds.jar
    |   |   |   |-- jstl.jar
    |   |   |   |-- jta.jar
    |   |   |   |-- log4j-1.2.11.jar
    |   |   |   |-- mysql-connector-java-3.1-nightly-20060403-bin.jar
    |   |   |   `-- standard.jar
    |   |   `-- web.xml
    |   |-- admin
    |   |   |-- admintemplate.xhtml
    |   |   |-- category.xhtml
    |   |   |-- index.xhtml
    |   |   `-- skeleton.xhtml
    |   |-- index.jsp
    |   `-- layout.css
    |-- lib
    |   `-- servlet.jar
    |-- meta
    |   `-- context.xml
    `-- src
        |-- beans
        |   `-- CategoryBean.java
        |-- blog
        |   |-- Category.hbm.xml
        |   |-- Category.java
        |   |-- Comment.hbm.xml
        |   |-- Comment.java
        |   |-- Post.hbm.xml
        |   `-- Post.java
        |-- hibernate.cfg.xml
        |-- log4j.properties
        `-- util
            `-- HibernateUtil.javaAnd, finally, the error message:
    Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:854)
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:721)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:164)
         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:760)
         ... 60 moreI don't really understand how I can setup the CLASSPATH in this
    context. So there should be something else. Does anyone have an
    idea?
    Thanks.
    Igor

    This is what I achived using the <metainf> tags from
    war task in build.xml. Look at the first code
    listing. The
    magic code is:
    <metainf dir="${meta.dir}">
    <include name="context.xml"/>
    </metainf>where ${meta.dir} is defined as ./meta and there
    resides
    the context.xml file (look at the project layout).Very good, thanks.
    Any guesses why Tomcat is not loading mysql jar from
    WEB-INF/lib directory?No. 8(
    My understanding is that JARs in the WEB-INF/lib are visible only to your web app. Those in /common/lib are visible to all apps and the container. Those in /server/lib are visible only to the container and no apps. It SHOULD work from WEB-INF/lib. I've done it that way, but it was an older version of Tomcat.
    Checked the Tomcat docs. They say to put it in /common/lib, but they don't explicitly forbid it in WEB-INF/lib.
    I'll try a simpler example.
    %

  • Is there a restriction on loading "javax" classes from WEB-INF/lib?

    I'm having trouble with a webapp in WL 10MP1 that is having trouble loading classes from the "jsr311-api-1.0.jar" in my WEB-INF/lib. Even though I have no trouble with it in Eclipse (no compile errors), classes from that jar fail with "NoClassDefFound" exceptions. I have a feeling it might be the fact that the packages in that jar start with "javax". Assuming that's the case, is there anything I can do to fix this?
    What's even stranger is that the errors I get are when I try to load them directly from the Spring context. However, if I remove the test references to those classes, there's other code that loads those classes later in the application startup (after the Spring context finishes loading), and they load perfectly fine (I turned on verbose class loading to verify this).

    Note that I've tried two other strategies that both result in the same failed state.
    I tried putting the "jsr311-api-1.0.jar" in $JDK_HOME/jre/lib/ext, but that causes a failure to find Spring classes. I then copied the "spring.jar" into $DOMAIN_HOME/lib, and then it fails to find CXF classes. After doing the same with "cxf-2.2.3.jar", it then fails to find "javax.servlet.ServletContextListener", which clearly tells me there's no benefit to this approach.
    Similarly, I tried copying the jars into $DOMAIN_HOME/lib, and that fails to find "org.apache.commons.logging.LogFactory". I could continue down this path, but it doesn't seem likely to succeed. Eventually, I'll get to a point where it just can't find the classes specific to my application, which I certainly can't copy into $DOMAIN_HOME/lib.
    The first basic problem is that I can't put anything into a higher-level classloader that will eventually reference classes in a lower-level classloader, because references can only go up the chain, and the second problem is that WebLogic appears to ignore classes in WEB-INF/lib in the "javax.*" packages. I think there might be an exception for "javax.xml.*", but not for other subpackages. I tried adding a "prefer-application-packages" clause to my weblogic-application.xml file, but that had no effect.

  • WEB-INF/lib (.war) Vs META-INF/MANIFEST.MF (.ear)

    What are the Class loading differences between libraries that are in a web application web-inf/lib and that are in class-path entry of META-INF/manifest.mf of a ear.
    I recently developed a web services application with a ejb endpoint.Then
    packaged it in a ear file with the classpath entry .The problem occured when I placed the weblogic.jar(and other third party jars) in the ear file which my ejb.jar uses as utility jar's. Jboss starts behaving weird.Some of the classes of jboss are overwritten and class cast exception errors started coming up.
    Overnight I changed the application to a servlet end point and placed all my jars in the WEB-INF/lib then everything started working smooth.
    Can any body help me , understand what is happening. Why doesn't j2ee have something like META-INF/lib

    What did you do to resolve this issue .. I'm having the exact same problem.
    What a nightmare.
    I found approximately 40 forums on this topic (and
    there are probably more), but noone has the definitive
    answer!
    Here's the problem....
    My servlet uses a utility class that resides in some
    other jar. That jar is then placed into the
    WEB-INF\lib directory of the WAR which in turn goes
    into the EAR. This is supposed to be all that is
    needed in order for the utility class to be found on
    the classpath.
    In fact, if you run the war in Tomcat as a standalone
    WAR it does in fact find it.... its when in an EAR
    deloployed to app server that the problem arises.
    I have had no luck with using any combination of
    putting the jar ANYWHERE in the EAR or WAR no matter
    if I specify the Class-Path: in the manifest(s) or
    not.
    I thought maybe that I was missing some config in the
    application.xml or web.xml but I couldn't find
    anything to support that.
    Maybe its dependent on the app server? I am using
    Orion, but the same problem can be found on J2EE RI
    release 1.3
    Work arounds:
    1. Simply put the utility jar in the lib directory of
    the server you're using
    2. Add an ejb module to the application.xml naming the
    utility jar as the ejb jar. Of course this is NOT an
    EJB jar and error messages/warnings will appear
    accordingly, but on Orion at least, it will load the
    classes needed... hooray!!
    Anyone got a definitive answer?

  • WEB-INF/lib WEB-INF/classes ClassLoader problem

    I have observed that in WL 8.1, a class in a jar deployed in WEB-INF/lib does not have the ability to access a resource deployed in WEB-INF/classes. Is this the intended behavior to not have WEB-INF/lib and WEB-INF/classes in the same ClassLoader? If so, is there a way to configure this behavior to give permission to classes loaded in WEB-INF/lib to the ClassLoader that has WEB-INF/classes?
              thanks,
              Kenneth Shin

    Are you really certain that's what's happening? Is it possible the jar file stored in WEB-INF/lib isn't found elsewhere in the CLASSPATH, perhaps by a higher-level classloader? You might consider setting "prefer-web-inf-classes" to true in your weblogic.xml file, to ensure that the jars in WEB-INF/lib are being used instead of from somewhere else.

Maybe you are looking for

  • "Server Busy" Error in Windows 8.1

    Since yesterday, I have been unable to use Dreamweaver due to a "Server Busy" error coming up when I start the program.  I have installed the available update through CC and am still etting the error, and all documentation on said error is for earlie

  • App wont show up on screen

    I download the app from the app store and it wont show it loading onto the screen.When it says its fully downloaded (watching from the app store) it still doesnt show onto the screen. From the app store I try to open it, but it wont open. Any help?

  • Cursor will not open iconfiles on desktop

    My cursor will not open file icons on my desk top. How can I make them open again.

  • How to update C7 on a mac?

    How is it possible to update my Nokia C7-00 on my iMac when my phone tell me that in order to update connect with a PC and PC Suite?

  • Photoshop Elements &IMac/Snow Leopard

    I have had Photshop Elements 3.0 installed on my Imac running on Leopard and it has been problem free. I have recently installed Snow Leopard  and now I am having problems opening some photos from IPhoto. When I have Iphoto set to edit in Elements bu