I am building a war file from eclipse it is working fine but when I tried a build a war file in Jenkins by using Maven plugin it is building a war file but it is not working. where exactly I am doing wrong..
i installed ubuntu 16.04
installed java 1.7
installed maven 3.3
installed jenkins
configured jenkins and with java and maven installation path. Given maven cmd
clean install.
the build is successful and war file is deployed to tomcat 8 container but I am getting an error like
HTTP Status 500 - No WebApplicationContext found: no ContextLoaderListener registered?
But when I export war file from my eclipse and copy it to tomcat container it is working fine and I followed https://www.youtube.com/watch?v=eIldJE4tSlA to configure maven project in jenkins.
Related
When building the Java web application through the maven build tool we get the war file as the artifact which is an executable file. So I have a basic doubt which is if we can execute the war file directly then why do we need an Apache tomcat webserver to host this war artifact?
I am using maven and jboss plugin. When I run this command
mvn clean install jboss-as:deploy
I will deploy in currently running jboss but I want to know which jar file it deploy..jar file generated in target folder or jar file in local repository?
By default it gets the bits from target folder. Look at targetDir property of the plugin.
You can find the details in the plugin documentation.
My IDEA project compiles and builds just fine when I compile using IntelliJ.
For some reason, when I deploy to tomcat using an exploded-war, 1 jar I have isn't included in the deployment and my spring app fails to load because it can't find the class.
The jar in question is a locally installed maven dependency i.e. on my laptop
Could this be the reason why it is being skipped by IDEA? It maybe tries to find the jar using maven, but since it is local is can't and skips it?
How can I fix this?
The IDEA project is a maven module and builds fine.
Put that jar into the libs folder of tomcat or embed it into your own jar using maven assembly plugin. https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html
I followed this tutorial http://www.mastertheboss.com/jboss-maven/jboss-maven-example-building-a-java-ee-6-application/ in order to have a simple web application to better understand Java EE and JBOSS. I set up the example project (by archetype) and compiled it.
However, I am stuck after running mvn compile. I want to deploy my application as a war file to my JBOSS webroot directory (in my case /usr/share/jboss-as/standalone/deployments/).
I think mvn package and mvn install must be executed. Where can I specify that I want a war file and that it should be copied to my deployment location on JBOSS?
Obviously, I can use the jboss maven plugin http://docs.jboss.org/jbossas/7/plugins/maven/latest/, which is addressed via console
jboss-as:deploy
Configuration is read from the POM file.
I have the following Problem:
I have a Maven MainProject with some SubProjects.
Two of this SubProjects are WebApplications. (One WebApp and one WebService)
If I build the MainProject in the command line with mvn clean package the 2 .war files are deployable in an external Apache Tomcat 6.0.
If I build the MainProject in eclipse with the m2e plugin i can also deploy the .war files into an external Tomcat.
BUT if i want to deploy the WebProjects in an Apache Tomcat in Eclipse, it doesn't boot.
The Problem is, that the file structure of the eclipse build for the internal Tomcat is different to the Maven one.
In the Maven build (console / m2e) the path is correctly from e.g. Project/src/main/java/com/... to WEB-INF/com...
The eclipse build for the internal Tomcat creates the structure like WEB-INF/main/java/com/...
So many of the .xml files which are mandatory for the Tomcat boot are not found bacause of the wrong path.
How can i tell eclipse that it should do the similar build like m2e or maven on command line so that i can use an internal tomcat in eclipse?
I am using
Eclipse Juno 4.2 or Helios 3.6
m2e - Maven Integration for Eclipse / 1.1.0.20120530-0009 / org.eclipse.m2e.feature.feature.group
Maven Integration for WTP / 0.15.2.20120306-2040 / org.maven.ide.eclipse.wtp.feature.feature.group
I fixed the problem.
The problem was the deployment assembly options in the eclipse projects.
Eclipse default option is to deploy /src to / folder.
Because of the maven structure /src/main/java/com the deployed folder also looks like /main/java/com.
I only had to change the source folder from /src to /src/main/java (the destination still remains /). If there are other necessary files i had to add them the same way, e.g. /src/main/resources.
The /src/main/webapp folder was already set correctly by eclipse to /WEB-INF