I've added mysql connector jar file, but class not found exception still arises.
*
Your error clearly says that the MySql connector jar is not placed in the correct folder. The correct folder is WEB-INF/lib. So place your jar in this folder.
You have your eclipse project referencing the mysql library. This allows the compiler, in eclipse, to find the classes when compiling. However, you do not have the library as part of your web app when you publish it to your tomcat server. You need to remove the library from the project, and copy the jar file into your app's WEB-INF/lib directory.
java.lang.classnotfoundexception com.mysql.jdbc.MySql issued by WebAppClassLoader. This tells that you need to include MySql connector jar in your web path under WEB-INF/lib directory.
Related
I'm deploying my war file to Oracle Weblogic Application 12c.
This war file, it's running OK on apache tomcat 8.
However, when I deploy it to Weblogic, I get this error:
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
I use Apache POI to read the excel file.
Possibility is run time version of mentioned class differs from version at compile time. You need to check whether you have multiple versions of this class in the classpath.Could you please check for existence of multiple jars containing this class.May be one inside the lib folder of server and another inside your application under lib folder.You need this jar just inside lib folder of your application.
Why application is not able to read the class from the build path? I did added ojdbc6.jar in the build path of the application.
Now when I kept this jar in the WEB-INF/lib directory, it worked fine.
Can someone please explain why it was not read from the project build path.
When you add it on the build path in your IDE , it is used for compiling the code (if there is a dependency on it).
Unless you package this and deploy on the server , the server has no reference to these files that were used for compilation. When you place it on WEB-INF/lib and package it , the jar file is also packaged in your .war file that is deployed and hence at runtime you will not get a Class missing or Driver missing error.
I'm developing a web application in JBoss in Eclipse Luna using external jars. I have imported the jars clicking on Project => Properties => Build Path => Add External Jars. Because the web application will need to use those jars, i have placed them in the MyApp.war/WEB-INF/lib folder, so, when the webapp will be finished, i'm sure i can just export the .war folder and deploy it on another server.
1) The problem is that everytime i turn on my pc in the morning, the deployment process gives me a ClassNotFoundException. I see that the external jars are no longer in their place. As far as i know, i'm not using any plugin to manage dependencies (i'm a newbie on webapps)
EDIT:
2) what i do is unpack my zip containing the jars again in the lib folder. Strangely, if i unpack them in a subfolder (for example, i place the jars in lib/httpcomponents/lib) JBoss cannot find the jars. What's the reason?
Try to inserting the external jar files in to jboss server lib directory (jboss\server\default\lib)
I am trying to use postgres on a EJB in a EAR, but i keep getting the error:
java.lang.ClassNotFoundException: org.postgresql.driver
so my app is not finding the jar. According to what I saw here: How to use 3rd party libraries in glassfish?, I should put the jar on either glassfish3/glassfish/domains/domain1/lib/ext or glassfishv3/glassfish/domains/domain1/lib, I tried both and is not working.
I was also not sure of something, should I add the jar to that folder and then reference the build path (using netbeans) of my app to the jar on that folder? or should I omit this step?
Anyhow, I tried both, referencing it and not doing it (only adding the jar to the folder in glassfish) and is not working.
So, how can I add an external jar to my application (EAR) that is put on a glassfish cluster?
I've build a spring-based web project in Eclipse using Maven. Dependencies and class path are correct and the deployment assembly also lists spring-web*.jar correctly. However, when I deploy it using WebSphere 8 from within Eclipse the mentioned JAR file is missing from the created libs folder under .metadata.plugins\org.eclipse.wst.server.core\tmp2*\WEB-INF\lib . This JAR however is listed under the module section as a submodule for the container. I wasn't able to find out, why this JAR is listed there and why it is not copied to the LIB folder.
It works with a Tomcat server, it works when I export the WAR and deploy it manually and it also works when I manually copy the JAR to the lib folder.
Q1: Is this specific to Websphere?
Q2: Why is SPRING-WEB listed as submodule and what effect has this?
Q3: How can I automatically deploy it correctly?
This seems to be a bug in WAS as reported here
You can either copy the missing JARs manually or you can use the "Run server with resources on server" option in the "Publishing settings for WebSphere Application Server" server settings.