jar file in Build Path not deploy into WEB-INF/lib folder - java

I am getting error below when I deploy my project in tomcat:
java.lang.ClassNotFoundException: org.apache.log4j.rolling.RollingFileAppender
It was due to missing of apache-log4j-extras-1.0.jar library. So I add the required jar files into my build path like the screenshot below:
I refresh and clean the project, and try to deploy again, but still didn't see the log4j and guava in my WEB-INF/lib folder under tomcat webapps. If I copy and paste the jars into WEB-INF/lib folder it will works, no error. But I don't want to copy paste each time I re-deploy the project. Please help.

Related

How to avoid compilation error while referring common jar files?

I have a common jar that needs to be placed in Tomcat / Jetty lib folder, so that all the WAR files will be able to access the JAR. My code gets compilation error as it could not link to the JAR. How to access the common JAR that is placed in the lib folder of the server?
I have used Manifest file in WAR to link to the external JAR. In manifest file I specified the external JARs as, "Class-Path: ". To avoid compilation error, I linked the external JARs as "Java BuildPath -> Libraries". Though the JARs are linked using above method, only the JARs found in "lib" folder of the server is used by the application :-)

java jar files are being deleted in the WEB-INF/lib folder

why does everytime I republish my project, the postgres jdbc jar file located inside the WEB-INF/lib on my .WAR file is being deleted?
I have to recopy the file back into the WEB-INF/lib to fix the ClassNotFoundException exception.
I'm using JBOSS AS 7.1
That jar is probably missing in the deployment assembly.
In the module Properties->Deployment Assembly make sure the jar is being added.

Unable to export non-jar files when web project is exported as a war file from Eclipse

I have developed a dynamic web application in Eclipse. I am using Tomcat as a server. In my lib folder I have placed one non-jar files( addressing.mar ). This file is necessary other wise I get an error in my application.
Now I export my project as war file and then deploy the project on Tomcat server. When I run the project I get an exception because addressing.mar cannot be found in the lib folder of the project. I don't know why addressing.mar isn't exported. If I manually place file in it, it is working, but I need a better solution.
Right click the project, open properties.
Under the Deployment Assembly page, you can configure what resources to include during export and their path in the WAR file. Just include your jar there and it will show up next time you export.

eclipse, wtp and tomcat configuration for source folder

I have a java project in eclipse which is having jar file reference of other projects.
Now, I have removed those jar files and added projects in eclipse, no compilation error in eclipse. I have configured Tomcat server in eclipse.
But server doesn't get loaded when i add project instead of jar files.
I have observed following path in eclipse workspace:
<<Eclipse IDE workspace>>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ESW\WEB-INF
under WEB-INF folder, jar files and class files are located. All jar files are loaded to 'jar' but under classes folder no class files are present at this directory. here i am expecting class files of the project which i have added in source folder instead of jar files. how can i do it?
Please try to use the Deployment Assembly option (Project Properties ---> Deployment Assembly ) to configure which files to be deployed to the WTP Tomcat . Before eclipse 3.5 or before , this option is called something likes J2EE Module Dependencies
Deploy path is relative to the your <<Eclipse IDE workspace>>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ESW\ while source path is relative to your project folder.

Jars not copied to Tomcat's lib folder

I am doing some basic spring stuff and stuck at some point.
I am getting ClassNotFoundException whenever I deploy my application on Tomcat.
I observed that the jars are not copied to Tomcats lib folder.
When I copied the jars manually to Tomcats lib folder it works fine.
Please let me know if I am making any blunder.
PS - I am using Spring tool suite 2.6.0,Tomcat 6 and its a Maven project.
Thanks.
Go to "Project properties -> Deployment Assembly page".
This page describes how your application will be packaged for deployment or export. And added new source "Maven dependency".
From Deployment Assembly page, Click Add... button
Then select "Java Build Path Entries"
"Maven dependency" should be in the list
It solves the issue and all jar got copied to tomcat
If you define "war" packaging for your maven project then your dependent libraries should be automatically copied to the WEB-INF/lib directory of the created .war file by the Maven WAR plugin.
Put your jars in the WEB-INF/lib directory:
In Project properties -> Deployment Assembly you should have a Source of /web with a Deployment Path of /. If this is there then any jars in the web/WEB-INF/lib directory will get deployed and picked up by the class loader. Note that sub-directories will not be picked up though, so put your jars directly in the lib directory.
You run three command in cmd or bash(where your pom.xml file placed) to get jar file and copy it into your WEB-INF/lib folder
mvn compile
mvn package
mvn install
I find only this way for resolved my problem:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Categories

Resources