How to set up swagger-jaxrs-server - maven

I have generated swagger-jaxrs-server from open api code generator using this petstore.yaml from swagger openapi as input . I want to run sever in STS as maven project.
I tried
1) Adding Tomcat7 plugin in porm.xml
2) Maven --> update project
3) Run as --> maven clean
4) Run as --> maven build --> goal:tomcat7:run
But I am getting error as
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< io.swagger:swagger-jaxrs-server >-------------------
[INFO] Building swagger-jaxrs-server 1.0.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes # swagger-jaxrs-server >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # swagger-jaxrs-server ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Spring\openapi\jaxrs-spec-server-generated\jaxrs-spec-server-generated\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # swagger-jaxrs-server ---
[INFO] No sources to compile
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes # swagger-jaxrs-server <<<
[INFO]
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # swagger-jaxrs-server ---
[INFO] Running war on http://localhost:8080/swagger-jaxrs-server
[INFO] Creating Tomcat server configuration at D:\Spring\openapi\jaxrs-spec-server-generated\jaxrs-spec-server-generated\target\tomcat
[INFO] create webapp with contextPath: /swagger-jaxrs-server
Jan 23, 2023 12:22:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 23, 2023 12:22:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jan 23, 2023 12:22:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Jan 23, 2023 12:22:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]

Related

Test file is not running via maven on azure pipeline

I'm using maven for building the automation project and using junit for running my test scripts . Its BBD framework where we have feature file, stepdefinition page.I have created pipeline , agent on azure devops . When running the pipeline it showing as build successful but still no tests cases are running .
Logs in maven :-
2022-10-07T13:21:37.3334382Z ##[section]Starting: Maven SmartBots/pom.xml
2022-10-07T13:21:37.3341187Z ==============================================================================
2022-10-07T13:21:37.3341428Z Task : Maven
2022-10-07T13:21:37.3341633Z Description : Build, test, and deploy with Apache Maven
2022-10-07T13:21:37.3341821Z Version : 3.169.2
2022-10-07T13:21:37.3341987Z Author : Microsoft Corporation
2022-10-07T13:21:37.3342231Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/maven
2022-10-07T13:21:37.3342495Z ==============================================================================
2022-10-07T13:21:38.2158528Z [command]/usr/bin/mvn -version
2022-10-07T13:21:38.2158912Z Apache Maven 3.5.4 (Red Hat 3.5.4-5)
2022-10-07T13:21:38.2159093Z Maven home: /usr/share/maven
2022-10-07T13:21:38.2159584Z Java version: 1.8.0_345, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.el8_6.x86_64/jre
2022-10-07T13:21:38.2160036Z Default locale: en_US, platform encoding: UTF-8
2022-10-07T13:21:38.2160548Z OS name: "linux", version: "4.18.0-372.26.1.el8_6.x86_64", arch: "amd64", family: "unix"
2022-10-07T13:21:38.2163101Z SYSTEMVSSCONNECTION exists true
2022-10-07T13:21:38.2164119Z [command]/usr/bin/mvn -f /E/azdosagents/agent2/_work/113/s/SmartBots/pom.xml test
2022-10-07T13:21:38.7149886Z [INFO] Scanning for projects...
2022-10-07T13:21:38.7906399Z [INFO]
2022-10-07T13:21:38.7921739Z [INFO] ------------------------< com.company:SmartBots >-------------------------
2022-10-07T13:21:38.7923753Z [INFO] Building com.optum.ManualTracker 0.1.1-SNAPSHOT
2022-10-07T13:21:38.7925045Z [INFO] --------------------------------[ jar ]---------------------------------
2022-10-07T13:21:39.7344370Z [INFO]
2022-10-07T13:21:39.7433482Z [INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SmartBots ---
2022-10-07T13:21:39.7994520Z [INFO] Using 'UTF-8' encoding to copy filtered resources.
2022-10-07T13:21:39.8047081Z [INFO] Copying 21 resources
2022-10-07T13:21:39.8074402Z [INFO]
2022-10-07T13:21:39.8075718Z [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # SmartBots ---
2022-10-07T13:21:39.8834648Z [INFO] Nothing to compile - all classes are up to date
2022-10-07T13:21:39.8835474Z [INFO]
2022-10-07T13:21:39.8836068Z [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SmartBots ---
2022-10-07T13:21:39.8901220Z [INFO] Using 'UTF-8' encoding to copy filtered resources.
2022-10-07T13:21:39.8901907Z [INFO] skip non existing resourceDirectory /E/azdosagents/agent2/_work/113/s/SmartBots/src/test/resources
2022-10-07T13:21:39.8902441Z [INFO]
2022-10-07T13:21:39.8902979Z [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # SmartBots ---
2022-10-07T13:21:39.8903395Z [INFO] No sources to compile
2022-10-07T13:21:39.8903634Z [INFO]
2022-10-07T13:21:39.8904175Z [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # SmartBots ---
2022-10-07T13:21:39.9333349Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:39.9334415Z [INFO] BUILD SUCCESS
2022-10-07T13:21:39.9334944Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:39.9335464Z [INFO] Total time: 1.237 s
2022-10-07T13:21:39.9337421Z [INFO] Finished at: 2022-10-07T08:21:39-05:00
2022-10-07T13:21:39.9338075Z [INFO] ------------------------------------------------------------------------
2022-10-07T13:21:40.0354312Z No test result files matching /E/azdosagents/agent2/_work/113/s/**/surefire-reports/TEST-*.xml were found, so publishing JUnit test results is being skipped.
2022-10-07T13:21:40.0408313Z ##[section]Finishing: Maven SmartBots/pom.xml

How do I set the port using maven?

I'm using Maven from the command line on Windows, but I don't need to necessarily change the port from the command line specifically.
Running the command
mvn -Djetty.http.port=8000 exec:java
results in the following output:
[INFO] Scanning for projects...
[WARNING] The project com.google.apis-samples:oauth2-cmdline-sample:jar:1
uses prerequisites which is only intended for maven-plugin projects but not
for non maven-plugin projects. For such purposes you should use the maven-
enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-
rules/requireMavenVersion.html
[INFO]
[INFO] ---------------------------------------------------------------------
---
[INFO] Building Example for the OAuth2 API using JSON and OAuth 2.0 1
[INFO] --------------------------------------------------------------------
----
[INFO]
[INFO] >>> exec-maven-plugin:1.1:java (default-cli) > validate # oauth2-
cmdline-sample >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.1:java (default-cli) < validate # oauth2-
cmdline-sample <<<
[INFO]
[INFO]
[INFO] --- exec-maven-plugin:1.1:java (default-cli) # oauth2-cmdline-sample
---
Jun 19, 2017 5:09:53 PM
com.google.api.client.util.store.FileDataStoreFactory
setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody:
C:\Users\roxlala\.store\oauth2_sample
Jun 19, 2017 5:09:53 PM
com.google.api.client.util.store.FileDataStoreFactory
setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner:
C:\Users\roxlala\.store\oauth2_sample
2017-06-19 17:09:53.229:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
2017-06-19 17:09:53.229:INFO::jetty-6.1.26
2017-06-19 17:09:53.259:INFO::Started SocketConnector#localhost:1871
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=<my-id>.
googleusercontent.com&redirect_uri=http:
//localhost:1871/Callback&response_type=code&scope=https://www.googleapis.
com/auth
/userinfo.profile%20https://www.googleapis.com/auth/userinfo.email
Attempting to open that address in the default browser now...

jenkins deploy war/ear to a container - why the .war file is renamed before it is deployed on the remoteserver

I'm new to jenkins and have a problem. I created a maven project (maven integration plugin 2.12.1) in jenkins (ver. 1.638). I got the source-code via git (maven web application).
Everything works fine, but at the end the .war which is moved/deployed via deploy plugin to the remote server has a wrong name.
I dont know why the .war file is renamed before it is deployed on the remoteserver.
It is called services.war instead of services_admin.war.
Screenshot jenkins:
https://i.stack.imgur.com/uc5wK.png
pom.xml:
<groupId>services_admin</groupId>[enter image description here][1]
<artifactId>services_admin</artifactId>
<name>services_admin</name>
<description>services_admin</description>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>1.5</wtpversion>
<additionalProjectFacets>
<jst.java>6.0</jst.java>
<jst.web>2.5</jst.web>
</additionalProjectFacets>
<additionalBuildcommands>
<buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
<buildcommand>org.eclipse.wst.validation.validationbuilder</buildcommand>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
</plugins>
<finalName>services_admin</finalName>
</build>
Build log:
[INFO] ------------------------------------------------------------------------
[INFO] Building services_admin 2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # services_admin ---
[INFO] Deleting D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # services_admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 120 resources
[INFO] Copying 307 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # services_admin ---
[INFO] Compiling 307 source files to D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\classes
[WARNING] D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\java\de\...\services\java\util\Cryptographer.java:[34,40] BASE64Encoder is internal proprietary API and may be removed in a future release
[WARNING] D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\java\de\...\services\java\util\Cryptographer.java:[59,39] BASE64Decoder is internal proprietary API and may be removed in a future release
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # services_admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # services_admin ---
[INFO] Compiling 48 source files to D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # services_admin ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # services_admin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [services_admin] in [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\webapp]
[INFO] Webapp assembled in [2328 msecs]
[INFO] Building war: D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.360 s
[INFO] Finished at: 2017-01-31T16:00:01+01:00
[INFO] Final Memory: 46M/447M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\pom.xml to services_admin/services_admin/2/services_admin-2.pom
[JENKINS] Archiving D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war to services_admin/services_admin/2/services_admin-2.war
channel stopped
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Deploying D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war to container Tomcat 7.x Remote
Redeploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Undeploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Deploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Finished: SUCCESS
remoteserver log:
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: list: Listing contexts for virtual host 'localhost'
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: deploy: Deploying web application '/services'
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: Uploading WAR file to D:\Programme_x64\tomcat\...\webapps\services.war
Feb 01, 2017 9:50:15 AM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deploying web application archive D:\Programme_x64\tomcat\...\webapps\services.war
Feb 01, 2017 9:50:15 AM org.apache.tomcat.util.digester.Digester begin
WARNUNG: [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
Feb 01, 2017 9:50:24 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMATION: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: No Spring WebApplicationInitializer types detected on classpath
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: Set web app root system property: 'OsWebApp.root' = [D:\Programme_x64\tomcat\...\temp\6-services\]
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: Initializing Spring root WebApplicationContext
Feb 01, 2017 9:50:31 AM com.sun.faces.config.ConfigureListener contextInitialized
INFORMATION: Mojarra 2.1.13 ( 20120907-1514) für Kontext '/services' wird initialisiert.
Feb 01, 2017 9:50:32 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMATION: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden. Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
Feb 01, 2017 9:50:33 AM com.sun.faces.config.configprovider.BaseWebConfigResourceProvider getResources
WARNUNG: JSF1067: Ressource /WEB_INF/wickedcharts.taglib.xml, die von der Konfigurationsoption javax.faces.CONFIG_FILES angegeben wird, kann nicht gefunden werden. Die Ressource wird ignoriert.
Feb 01, 2017 9:50:33 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFORMATION: Running on PrimeFaces 5.3
Feb 01, 2017 9:50:33 AM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deployment of web application archive D:\Programme_x64\tomcat\...\webapps\services.war has finished in 17,323 ms
i dont use the "deploy plugin - deploy war/ear to a container" for this project. Instead of that im using now "Send files to a windows share - CIFS Publishers".
The problem with the "deploy plugin - deploy war/ear to a container" i could solve :(.
Anyway thx for ur help :).
Best regards

jdbc.OracleDriver error while building Jenkins job

I would be very thankful, if somebody could explain this to me. What the hell this Jenkins is trying to do in my situation.
Here is the piece of my log file:
I have created the simple job. Have linked to it my SVN repository, have set Maven Goals, same things as always. But this time he refused to work. The last 3 lines are repeating every minute. I have waited for an hour and then aborted the job.
In my MAVEN_OPTS I said to him where he can find JDBC Driver.
I have a couple of another jobs with the same configuration, and they are working pretty fine.
Is Jenkins trying to download the jdbc Driver for each testcase? Or am I wrong?
How can I fix this?
Thanks for the help.
P.S. here is the log file, at the end I have aborted job manually.
Started by user admin
Building in workspace /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace
[WS-CLEANUP] Deleting project workspace...
Checking out a fresh workspace because there's no workspace at /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace
Cleaning local Directory .
Checking out http://development.bonprix.net/svn/Java/app/Invoice/InvoiceUserInterface/trunk/InvoiceUserInterface at revision '2016-07-28T13:44:48.317 +0000'
A src
A src/test
A src/test/resources
A src/test/resources/testng-suite.xml
A src/test/resources/application-test.properties
A src/test/java
A src/test/java/de
A src/test/java/de/bonprix
A src/test/java/de/bonprix/dinvoice
A src/test/java/de/bonprix/dinvoice/modules
A src/test/java/de/bonprix/dinvoice/modules/invoice
A src/test/java/de/bonprix/dinvoice/modules/invoice/InvoicePresenterTest.java
A src/main
A src/main/java
A src/main/java/de
A src/main/java/de/bonprix
A src/main/java/de/bonprix/dinvoice
A src/main/java/de/bonprix/dinvoice/DInvoiceUI.java
A src/main/java/de/bonprix/dinvoice/model
AU src/main/java/de/bonprix/dinvoice/model/DiscountsClaims.java
AU src/main/java/de/bonprix/dinvoice/model/AuShipmentType.java
AU src/main/java/de/bonprix/dinvoice/model/GnCurrency.java
AU src/main/java/de/bonprix/dinvoice/model/IvType.java
AU src/main/java/de/bonprix/dinvoice/model/InvoicePosition.java
A src/main/java/de/bonprix/dinvoice/dao
AU src/main/java/de/bonprix/dinvoice/dao/InvoiceDao.java
A src/main/java/de/bonprix/dinvoice/modules
A src/main/java/de/bonprix/dinvoice/modules/invoice
A src/main/java/de/bonprix/dinvoice/modules/invoice/ui
A src/main/java/de/bonprix/dinvoice/modules/invoice/ui/InvoiceViewImpl.java
A src/main/java/de/bonprix/dinvoice/modules/invoice/InvoiceModule.java
A src/main/java/de/bonprix/dinvoice/modules/invoice/InvoicePresenter.java
A src/main/java/de/bonprix/dinvoice/modules/invoice/InvoiceView.java
A src/main/resources
A src/main/resources/de
A src/main/resources/de/bonprix
A src/main/resources/de/bonprix/dinvoice
A src/main/resources/de/bonprix/dinvoice/dao
AU src/main/resources/de/bonprix/dinvoice/dao/InvoiceDao.xml
A src/main/resources/de/bonprix/dinvoice/dinvoice.css
A src/main/resources/application.properties
A src/main/resources/i18n
A src/main/resources/i18n/dinvoice-messages.properties
A src/main/resources/i18n/dinvoice-messages_en.properties
A src/main/resources/i18n/dinvoice-messages_de.properties
A src/main/webapp
A pom.xml
At revision 21398
Parsing POMs
Established TCP socket on 38864
[workspace] $ /usr/lib/jvm/java-8-openjdk-amd64//bin/java -Djava.awt.headless=true -Doracle.driver.path=/opt/oracle/instantclient_11_2/ojdbc6.jar -cp /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.7.jar:/opt/maven/maven-current/boot/plexus-classworlds-2.5.1.jar:/opt/maven/maven-current/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven/maven-current /var/jenkins_home/war/WEB-INF/lib/remoting-2.60.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.7.jar /var/jenkins_home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar 38864
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/pom.xml -s /opt/maven/maven-current/conf/settings.xml -gs /opt/maven/maven-current/conf/settings.xml clean deploy
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for de.bonprix.invoice:InvoiceUserInterface:war:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:cobertura-maven-plugin is missing. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 624, column 12
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:properties-maven-plugin is missing. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 637, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 628, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-clean-plugin is missing. # line 60, column 12
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:buildnumber-maven-plugin is missing. # line 68, column 12
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:build-helper-maven-plugin is missing. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 612, column 12
[WARNING] 'dependencyManagement.dependencies.dependency.exclusions.exclusion.groupId' for org.springframework:spring-context-support:jar with value '*' does not match a valid id pattern. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 221, column 16
[WARNING] 'dependencyManagement.dependencies.dependency.exclusions.exclusion.artifactId' for org.springframework:spring-context-support:jar with value '*' does not match a valid id pattern. # de.bonprix.base.webbase:WebBase:4.4.26, /opt/maven/cache/de/bonprix/base/webbase/WebBase/4.4.26/WebBase-4.4.26.pom, line 222, column 19
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[HUDSON] Collecting dependencies info
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building InvoiceUserInterface 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml (727 B at 3.7 KB/sec)
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml (727 B at 3.7 KB/sec)
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/cobertura-maven-plugin/maven-metadata.xml
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/cobertura-maven-plugin/maven-metadata.xml
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/cobertura-maven-plugin/maven-metadata.xml (605 B at 19.1 KB/sec)
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/cobertura-maven-plugin/maven-metadata.xml (605 B at 17.9 KB/sec)
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/properties-maven-plugin/maven-metadata.xml
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/properties-maven-plugin/maven-metadata.xml
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/properties-maven-plugin/maven-metadata.xml (421 B at 14.7 KB/sec)
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/properties-maven-plugin/maven-metadata.xml (421 B at 13.3 KB/sec)
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/buildnumber-maven-plugin/maven-metadata.xml
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/buildnumber-maven-plugin/maven-metadata.xml
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-release/org/codehaus/mojo/buildnumber-maven-plugin/maven-metadata.xml (602 B at 21.8 KB/sec)
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/codehaus/mojo/buildnumber-maven-plugin/maven-metadata.xml (602 B at 21.8 KB/sec)
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-release/org/apache/maven/plugins/maven-jar-plugin/maven-metadata.xml
[INFO] Downloading: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/apache/maven/plugins/maven-jar-plugin/maven-metadata.xml
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-snapshot/org/apache/maven/plugins/maven-jar-plugin/maven-metadata.xml (743 B at 29.0 KB/sec)
[INFO] Downloaded: http://digistyle.bonprix.net/artifactory/plugins-release/org/apache/maven/plugins/maven-jar-plugin/maven-metadata.xml (743 B at 27.9 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # InvoiceUserInterface ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-source (add-source) # InvoiceUserInterface ---
[INFO] Source directory: /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/target/generated-sources/apt added.
[INFO] Source directory: /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/target/generated-sources/classes added.
[INFO]
[INFO] --- maven-processor-plugin:2.2.4:process (process) # InvoiceUserInterface ---
[WARNING] No processors specified. Using default discovery mechanism.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # InvoiceUserInterface ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # InvoiceUserInterface ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 13 source files to /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # InvoiceUserInterface ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) # InvoiceUserInterface ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # InvoiceUserInterface ---
[INFO] Surefire report directory: /var/jenkins_home/jobs/SCM/jobs/DInvoice/jobs/InvoiceUserInterface/workspace/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running de.bonprix.dinvoice.modules.invoice.InvoicePresenterTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#7a92922
Jul 28, 2016 1:44:56 PM org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners
INFO: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener#6121c9d6, org.springframework.test.context.support.DependencyInjectionTestExecutionListener#87f383f, org.springframework.test.context.support.DirtiesContextTestExecutionListener#4eb7f003, org.springframework.test.context.transaction.TransactionalTestExecutionListener#eafc191, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener#612fc6eb]
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Jul 28, 2016 1:44:57 PM org.springframework.context.support.GenericApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.GenericApplicationContext#77a57272: startup date [Thu Jul 28 13:44:57 UTC 2016]; root of context hierarchy
Jul 28, 2016 1:44:57 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'aspectConfiguration' of type [class de.bonprix.configuration.AspectConfiguration$$EnhancerBySpringCGLIB$$48895d0c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Using test database connection test at jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.1.194)(PORT=18000)))(CONNECT_DATA=(SID=orcl)))
Jul 28, 2016 1:44:58 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: oracle.jdbc.OracleDriver
Build was aborted
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Aborted by admin
channel stopped
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
Finished: ABORTED

Why can't I shutdown tomcat 7 embedded from maven plugin?

I'm using tomcat7-maven-plugin 2.2 to run a webapp from command line (I'm on Windows 8.1, Java 1.7.0_51 and Maven 3.2.1).
This is the configuration (pretty straightforward, I guess):
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<address>localhost</address>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
I run Maven with mvn tomcat7:run and it starts correctly, the server starts up, the webapp loads, and I can interact with it.
The command prompt in which I run Maven is busy showing Tomcat output (this looks fine to me):
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <project-name-here> 0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # <project-name-here> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # <project-name-here> ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> ---
[INFO] Running war on http://localhost:8080/
[INFO] Using existing Tomcat server configuration at c:\workspace\<project-name-here>\target\tomcat
[INFO] create webapp with contextPath:
apr 01, 2014 10:39:50 AM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["http-bio-127.0.0.1-8080"]
apr 01, 2014 10:39:50 AM org.apache.catalina.core.StandardService startInternal
Informazioni: Starting service Tomcat
apr 01, 2014 10:39:50 AM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47
apr 01, 2014 10:39:52 AM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"]
Then, I want to shutdown the server: I run mvn tomcat7:shutdown from a separate command prompt, but all I get is this:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <project-name-here> 0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:shutdown (default-cli) # <project-name-here> ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.083 s
[INFO] Finished at: 2014-04-01T10:39:59+01:00
[INFO] Final Memory: 9M/154M
[INFO] ------------------------------------------------------------------------
"cmd" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
That last line reads:
"cmd" is not a recognized internal or external command, an executable
or a batch file.
I can stop Tomcat from the first command prompt hitting Ctrl+C, but since I need to pass all this others, I'd like to offer them a script to start the webapp and a script to stop it.
What's wrong? Is it a plugin error? Is it a configuration error on my side?
EDIT
If I add <fork>true</fork> to the POM, the server crashes with this error:
[...]
Informazioni: Starting service Tomcat
apr 03, 2014 2:05:29 PM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47
apr 03, 2014 2:05:31 PM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.711 s
[INFO] Finished at: 2014-04-03T14:05:31+01:00
[INFO] Final Memory: 26M/368M
[INFO] ------------------------------------------------------------------------
ERROR: IllegalAccessException for stop method in class org.apache.tomcat.maven.plugin.tomcat7.run.ExtendedTomcat
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.maven.common.run.EmbeddedRegistry.shutdownAll(EmbeddedRegistry.java:110)
at org.apache.tomcat.maven.common.run.EmbeddedRegistry$1.run(EmbeddedRegistry.java:69)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:351)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:753)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:502)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 9 more
Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/core/ContainerBase$StopChild
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:1173)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.ContainerBase$StopChild
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 13 more
As far as I know you need to use Ctrl + c after starting Tomcat server with mvn tomcat7:run to shut it down as it's attached to the current Maven run.
The shutdown goal is used to be called after e.g. performing some tests (integration tests) to finish all the job in a clean way.
have a look at the fork option http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html#fork
So with this option you are able to start embeded tomcat run some tests then shutdown.
HTH
An alternative is if the Tomcat maven plugin had a way to enable the shutdown port (default 8005) then you can just send the default shutdown string (default "shutdown") to shut it down.
Using a JMX client, the shutdown port is set to -1 when I run the plugin run goal.

Resources