Not able to add the Spring jars into EAR under Tomcat Server. note :i added those in WEBINF/lib - classpath

i have added all the jars into WEBINF/lib but it is not added into my EAR,
When i add EAR to TOMCAT server i am seeing only one jar,
WEBINF/lib:
all my spring jars,
Tomcat V7.0
->MySpringExampleEAR
->only one jar
so i am getting below exception
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListner in eclipse-jee-kepler-SR2-win32.
I have tried by using Deplyoment assembly.Still am getting the same exception
Currrently not able to attach Image.
Can anybody please help me to resolve this issue?
Is there any solution other than MAVEN deploy for this?

Please read .war vs .ear file
Tomcat does not handle .ear files, only .war files.
If you are using Maven to create a web app that is intended to be deployed to Tomcat, do not use the maven ear plugin.

Related

Deploying an EJB .jar to jBoss/WildFly from Eclipse

I am new to Java EE. I use Eclipse, jBoss/WildFly and Maven. I have a multi module Maven project:
parent Maven project (pom)
web application (war)
EJB project (jar)
Currently, the EJB jar project is packaged inside the web application and the entire solution is deployed as one war file.
I want to change it: I need to deploy the war and the jar projects to the application server independently (as two independent applications). Then the web project could access the EJBs via their remote interfaces.
The problem:
I can deploy the war project in Eclipse with the Run As > Run On Server context menu, however when I attempt to deploy the jar project in the same way, I get an error message saying that the project cannot be deployed.
How can I deploy my projects independently from Eclipse?
Should I wrap the jar project into an ear project? If so, can I convert my jar project into an ear project, or do I have to keep my jar project and create one more project to wrap it into an ear? (I would no like to introduce one more project).
Look at your packaging for your EJB project. You should have
<packaging>ejb</packaging>
This will allow you to run the EJB project on the server.

Issue deploying EAR project from eclipse to EAP 6.2.0 using JBoss Tools Plugin

I have a maven EAR project, which contains a couple of WAR and JAR files. I'm using Spring STS IDE with JBoss Tools 1.6.0 (latest).
When I try to deploy my EAR to JBoss EAP 6.2.0 with JBoss Tools from STS i'm facing the following issues.
My Jars (external jars and project jar) are getting copied into WEB-INF/lib and EAR/lib, where i expected it to be only in EAR/lib.
EAR application.xml is not getting copied into EAR/META-INF/ folder
But when i use terminal to build my project and deploy EAR, i'm not experiencing these issue and JBoss starts without any problem
Here's its solved JBIDE-19047 The main issues are,
jars are getting copied into WEB-INF/lib due to skinnywar not supported by eclipse m2e-wtp plugin and this can be solved by adding <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> in war plugin configuration.
application.xml not getting copied into ear/META-INF/ folder, if you have any unresolved dependency in any of the pom then this would occur, so make sure all jar dependencies are available.

tomcat7 web servlet wouldn't work

So I'm using eclipse and wrote 2 separate project. My servlet project is using the JAR file from the other project and it runs fine on the tomcat server built in to eclipse. However, if I package the servlet project into a WAR file and deploy it on the tomcat7 directly on my machine (not through eclipse), then it wouldn't run. I'm worried it might be some problem with the classpath. When I ran in eclipse, I had to manually went in RunConfiguration and add those jar files into the tomcat server classpath. How would I do that through command line?
You shouldn't mess with the tomcat classpath. Put the jar in the WEB-INF/lib directory of your war, as all the other libraries that your webapp uses.

Netbeans Maven project to IDEA 12

Short version: I would like to deploy Maven generated WAR to Local Tomcat server and not to build the war with internal IDEA process since the produced WAR file is not the same as the Maven generated one.
Long version: I have been using the Netbeans IDE for my Maven Java project. One of the modules is packaged as a WAR and should be deployed to tomcat server.
In Netbeans when I selected "Run" on the Web Module it asks for application server configuration then it runs the maven 'package' goal and deploys the application(generated WAR) to the Tomcat Server probably via Tomcat manager. So far so good.
We are now in the process of switching to Scala language. Scala classes extend old Java classes and the project is now "Mixed". I have configured Maven to compile the project as a mix of scala and java code. Maven produces a WAR which can then be deployed to Tomcat server without trouble - everything works as it should.
Now I would like to switch to Intellij-idea 12 IDE. But I have a problem: IDEA is refusing to deploy Maven created artifacts and insists of building one by it's own. The war is not the same and can't be used. Is there a way to tell IDEA to use Maven generated WARs and not try to make it's own ?
Just for the record I have already read these articles:
http://riddhimandas.com/blog/111
http://www.jetbrains.com/idea/webhelp/configuring-web-application-deployment.html Manually build WAR by IDEA - Want the maven generated one
IntelliJ IDEA: Maven, project compilation and deployment There is a hint here that IDEA can deploy Maven artifact from the 'target' directory but there is no information on how to do that.
With the help of CrazyCoder I figured it out.
You can make Intellij-Idea to upload your war by selecting External Source
But that's not all, even if you have a context.xml file difining your Context Root inside your WAR file: http://docs.oracle.com/javaee/1.4/tutorial/doc/WebApp3.html
You must specify one for every artifact you deploying (Unless someone will correct me)
The before launch section can be used to tell Idea what to Maven Goal to Run if any

Tomcat won't undeploy ROOT.war

I deployed using the REST API of Tomcat Manager (/manager/text) my application. The war is ROOT.war. When I try to undeploy it using /manager/text/undeploy?path=/ Tomcat fails to undeploy with response:
FAIL - Unable to delete [C:\Program Files\apache-tomcat-7.0.27\webapps\ROOT]. The continued presence of this file may cause problems.
But if I try to use the Tomcat Manager GUI it can undeploy the war
Does someone know how can I solve this problem?
Thanks
Have you tried deleting the ROOT deployed directory manually?
The war's are simply exploded to directories under the webapps folder.