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

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.

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 :-)

why loading into weblogic/domain/lib

I am working on weblogic 12c and i deploy .ear file which inside contains .jars and project stuff.
After ANT Build all java classes goes as jar inside 'project/bin' folder. This bin folder will be part of .ear file.
I then deploy .ear on weblogic. But apart from doing this, it is also
forcing me to copy 'project/bin' folder stuff into 'Weblogic/domain/lib' folder and restart the weblogic server. If i dont do this, i am getting ClassNotFoundException for all java classes.
Why should i copy 'project/bin' folder into 'Weblogic/domain/lib' ?
Is this a ideal way of doing deployment ?
If not, How to avoid doing this every time ?
Please help.

create ear file from myeclipse workspace

Actually I use MyEclise to develop and deploy a enterprise project(EAR file).
I use Java Build Path to add some other projects and link sources, and added several jar files (as external jar and user library) to my project. (I used J2EE technology and there are some default jar of course )
By myeclise deploying manager I deployed my project on weblogic base_domain and then by weblogic console I deploy it on weblogic.
All is set and there is no problem in all steps.
Now I wanna to create EAR file manually, first I created WAR file which included some jsf files and web-inf directory contains classes, lib directories and some important file like web.xml , facec-config.xml and etc.
In classes folder I have .class files which build correctly from .java files, and on lib directory**I copied all jar file from web-inf/lib directory** which created automatically by myeclipse deploying manager on weblogic base domain folder.
I added this War file into EAR file along APP-INF directory which contains all jar files from APP-INF/lib directory on weblogic base domain folder and META-INF directorywhat contains application.xml file.
When I deploy this ear file on weblogic there is so many error and problems.
Could you tell me what is the correct way to create that EAR file.
Thanks in advance
If you have an enterprise project, just export the EAR file. Right click the enterprise project, select Export, then select MyEclipse JEE->Ear File and follow instructions on the wizard (basically, specify a destination for the EAR file, on the file system). This should give you an EAR file that contains the same as what was deployed on Weblogic.

Missing files when compiled to WAR

I have quite an interesting issue. I'm running maven to compile my Servlet site into a single WAR File. This works completely fine on my local machine; and even when I change my deployment settings to use just the war file, it works fine. However, when I deploy the WAR file to the server, I'm getting 404 errors. I'm no expert with WAR files, so is there some sort of internal file that specifies the location of resources that I need to look at?
First try to unzip your war (wars, jars, ears are zip files) and see if your files are actually there, verify if your unzipped war contains:
dir WEB-INF
file WEB-INF/web.xml
dir WEB-INF/lib with the jars your aplication depends on
dir WEB-INF/classes with *.class files, where your servlets and related classes are supposed to be (if you have decided to have them there and not in a jar in WEB-INF/lib)
static resources in the root directory
You could make your conclusions of what is missing in your war.
You could also try to build your own war manually (creating a zip file with the structure I mentioned above and renaming it as *.war) if you have problems with doing it by your IDE's options

How do I make tomcat include libs from the current project?

I've read somewhere as a good practice, that it's better to have the required libs included in each project, then just add all the libs you'll ever need to the tomcat folder. Well right now Tomcat seems to need all the required libs to be in lib folder of Tomcat. How can I make it use the libs from the build path of the project? i'm using tomcat 7.032 in through Eclipse.
The libraries of a webapp must be in the WEB-INF/lib directory of the deployed web application directory or war file.
Every jar file in this directory will be in the classpath of the webapp, and won't be in the classpath of the other deployed webapps. You indeed shouldn't put webapp libraries into Tomcat's classpath.

Categories

Resources