Maven build fails with Munit tests - maven

Built a mavenized mule application as a domain project in anypoint studio. Added munit tests. I can run the munit test suites and all tests complete successfully. I can build and deploy the application when skipping the munit tests (with -DskipMunitTests). However, now I want the build to include the munit tests, but when I remove -DskipMunitTests, I get the following error...
[INFO] Building Mule inventoryService Application 1.0.0-SNAPSHOT
[INFO] --- mule-app-maven-plugin:1.2:attach-test-resources (default-attach-test-resources) # inventoryService ---
[INFO] attaching test resource C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\src\main\app
[INFO] --- build-helper-maven-plugin:1.7:add-resource (add-resource) # inventoryService ---
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # inventoryService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] Copying 6 resources
[INFO] Copying 2 resources
[INFO] skip non existing resourceDirectory C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\mappings
[INFO] --- mule-app-maven-plugin:1.2:filter-resources (default-filter-resources) # inventoryService ---
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # inventoryService ---
[INFO] Nothing to compile - all classes are up to date
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # inventoryService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 9 resources
[INFO] Copying 6 resources
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # inventoryService ---
[INFO] Nothing to compile - all classes are up to date
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # inventoryService ---
[INFO] --- munit-maven-plugin:1.3.4:test (test) # inventoryService ---
[INFO] Acquiring dynamic ports...
[INFO] Dynamic port definition [DONE]
[INFO] Mule working directory set to: C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\target\.mule
[org.mule.munit.remote.RemoteRunner]Run Started
Coverage port: 51497 resources: BCStd-httpListenerConfig.xml,global.xml,interfaces.xml,inventoryService.xml
INFO 2018-02-15 11:40:41,084 [Thread-1] org.mule.munit.plugins.coverage.server.MunitCoverageServer: Waiting for coverage connection
INFO 2018-02-15 11:40:41,099 [main] org.mule.munit.runner.MuleContextManager: Loading mule-app.properties ...
INFO 2018-02-15 11:40:41,144 [main] org.mule.munit.runner.domain.MunitDomainContextBuilder: Loading mule-deploy.properties ...
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/user/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.5/log4j-slf4j-impl-2.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/user/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
INFO 2018-02-15 11:40:41,529 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker
INFO 2018-02-15 11:40:41,674 [main] org.mule.config.spring.MuleDomainContext: Refreshing org.mule.config.spring.MuleDomainContext#335b5620: startup date [Thu Feb 15 11:40:41 CST 2018]; root of context hierarchy
INFO 2018-02-15 11:40:42,969 [main] org.mule.config.spring.processors.ContextExclusiveInjectorProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO 2018-02-15 11:40:43,734 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx2.log
INFO 2018-02-15 11:40:43,749 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx2.log
INFO 2018-02-15 11:40:44,254 [main] org.mule.config.spring.SpringXmlDomainConfigurationBuilder: Configured Mule using "org.mule.config.spring.SpringXmlDomainConfigurationBuilder" with configuration resource(s): "[ConfigResource{resourceName='jar:file:/C:/Users/user/.m2/repository/com/mercury/mulesoft/muledomain/1.0.0-SNAPSHOT/muledomain-1.0.0-SNAPSHOT.zip!/mule-domain-config.xml'}]"
INFO 2018-02-15 11:40:44,254 [main] org.mule.util.queue.QueueXaResourceManager: Starting ResourceManager
INFO 2018-02-15 11:40:44,254 [main] org.mule.util.queue.QueueXaResourceManager: Started ResourceManager
INFO 2018-02-15 11:40:44,294 [main] org.mule.module.http.internal.listener.DefaultHttpListenerConfig: Listening for requests on http://0.0.0.0:8081
INFO 2018-02-15 11:40:44,299 [main] org.mule.DefaultMuleContext:
Mule Runtime and Integration Platform
Version: 3.8.4 Build: 0fc91f08
MuleSoft, Inc.
For more information go to http://www.mulesoft.org
Server started: 2/15/18 11:40 AM
Server ID: id
JDK: 1.8.0_111 (mixed mode)
OS encoding: Cp1252, Mule encoding: UTF-8
OS: Windows 7 - Service Pack 1 (6.1, amd64)
Host: blah (ip)
Agents Running: None
INFO 2018-02-15 11:40:44,349 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker
INFO 2018-02-15 11:40:44,369 [main] org.mule.module.extension.internal.manager.DefaultExtensionManager: Starting discovery of extensions
INFO 2018-02-15 11:40:44,504 [main] org.mule.module.extension.internal.manager.DefaultExtensionManager: Discovered 1 extensions
INFO 2018-02-15 11:40:44,504 [main] org.mule.module.extension.internal.manager.DefaultExtensionManager: Registering extension validation (version 3.8)
INFO 2018-02-15 11:40:44,514 [main] org.mule.munit.runner.spring.config.MunitApplicationContext: Refreshing org.mule.munit.runner.spring.config.MunitApplicationContext#397ef2: startup date [Thu Feb 15 11:40:44 CST 2018]; parent: org.mule.config.spring.MuleDomainContext#335b5620
WARN 2018-02-15 11:40:45,324 [main] org.mule.transport.http.builder.HttpHeaderDefinitionParser: Schema warning: Use of element <header> is deprecated. HTTP transport is deprecated and will be removed in Mule 4.0. Use HTTP module instead..
WARN 2018-02-15 11:40:45,529 [main] org.mule.munit.runner.spring.config.MunitApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Secure_Property_Placeholder': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found
INFO 2018-02-15 11:40:45,549 [main] org.mule.lifecycle.AbstractLifecycleManager: Disposing RegistryBroker
java.lang.RuntimeException: org.mule.api.config.ConfigurationException: Error creating bean with name 'Secure_Property_Placeholder': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found (org.mule.api.lifecycle.InitialisationException)
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:59)
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:45)
at org.mule.munit.remote.RemoteRunner.runTestSuite(RemoteRunner.java:75)
at org.mule.munit.remote.RemoteRunner.run(RemoteRunner.java:55)
at org.mule.munit.remote.RemoteRunner.main(RemoteRunner.java:39)
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'Secure_Property_Placeholder': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found (org.mule.api.lifecycle.InitialisationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89)
.....
... 4 more
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'Secure_Property_Placeholder': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:112)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:177)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:100)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
... 12 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Secure_Property_Placeholder': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1512)
.....
... 15 more
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'key' threw exception; nested exception is java.lang.RuntimeException: Property MULEENC could not be found
PropertyAccessException 2: org.springframework.beans.MethodInvocationException: Property 'location' threw exception; nested exception is java.lang.RuntimeException: Property mule.env could not be found
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:121)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1508)
... 27 more
INFO 2018-02-15 11:40:45,899 [main] org.mule.munit.runner.MuleContextManager: Loading mule-app.properties ...
INFO 2018-02-15 11:40:45,899 [main] org.mule.munit.runner.domain.MunitDomainContextBuilder: Loading mule-deploy.properties ...
INFO 2018-02-15 11:40:45,909 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker
INFO 2018-02-15 11:40:45,924 [main] org.mule.config.spring.MuleDomainContext: Refreshing org.mule.config.spring.MuleDomainContext#3b95a6db: startup date [Thu Feb 15 11:40:45 CST 2018]; root of context hierarchy
INFO 2018-02-15 11:40:46,094 [main] org.mule.config.spring.processors.ContextExclusiveInjectorProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO 2018-02-15 11:40:46,194 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx2.log
INFO 2018-02-15 11:40:46,199 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx2.log
INFO 2018-02-15 11:40:46,209 [main] org.mule.config.spring.SpringXmlDomainConfigurationBuilder: Configured Mule using "org.mule.config.spring.SpringXmlDomainConfigurationBuilder" with configuration resource(s): "[ConfigResource{resourceName='jar:file:/C:/Users/user/.m2/repository/com/mercury/mulesoft/muledomain/1.0.0-SNAPSHOT/muledomain-1.0.0-SNAPSHOT.zip!/mule-domain-config.xml'}]"
INFO 2018-02-15 11:40:46,209 [main] org.mule.util.queue.QueueXaResourceManager: Starting ResourceManager
INFO 2018-02-15 11:40:46,209 [main] org.mule.util.queue.QueueXaResourceManager: Started ResourceManager
[org.mule.munit.remote.CoverageManager]Calculating application coverage for resources: BCStd-httpListenerConfig.xml,global.xml,interfaces.xml,inventoryService.xml
java.lang.RuntimeException: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig#73613ae5
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:59)
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:45)
at org.mule.munit.remote.RemoteRunner.runTestSuite(RemoteRunner.java:75)
at org.mule.munit.remote.RemoteRunner.run(RemoteRunner.java:55)
at org.mule.munit.remote.RemoteRunner.main(RemoteRunner.java:39)
Caused by: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig#73613ae5
at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:249)
at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:99)
at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:71)
.....
... 4 more
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
.....
... 20 more
INFO 2018-02-15 11:40:46,234 [main] org.mule.munit.runner.MuleContextManager: Loading mule-app.properties ...
INFO 2018-02-15 11:40:46,239 [main] org.mule.munit.runner.domain.MunitDomainContextBuilder: Loading mule-deploy.properties ...
INFO 2018-02-15 11:40:46,244 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker
INFO 2018-02-15 11:40:46,254 [main] org.mule.config.spring.MuleDomainContext: Refreshing org.mule.config.spring.MuleDomainContext#29fe4840: startup date [Thu Feb 15 11:40:46 CST 2018]; root of context hierarchy
INFO 2018-02-15 11:40:46,439 [main] org.mule.config.spring.processors.ContextExclusiveInjectorProcessor: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO 2018-02-15 11:40:46,529 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-tx-log\tx2.log
INFO 2018-02-15 11:40:46,529 [main] org.mule.util.journal.TransactionJournal: Using files for tx logs C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx1.log and C:\Users\user\AnypointStudio\BPMtoMulesoft\inventoryService\.\.mule\queue-xa-tx-log\tx2.log
INFO 2018-02-15 11:40:46,559 [main] org.mule.config.spring.SpringXmlDomainConfigurationBuilder: Configured Mule using "org.mule.config.spring.SpringXmlDomainConfigurationBuilder" with configuration resource(s): "[ConfigResource{resourceName='jar:file:/C:/Users/user/.m2/repository/com/mercury/mulesoft/muledomain/1.0.0-SNAPSHOT/muledomain-1.0.0-SNAPSHOT.zip!/mule-domain-config.xml'}]"
INFO 2018-02-15 11:40:46,559 [main] org.mule.util.queue.QueueXaResourceManager: Starting ResourceManager
INFO 2018-02-15 11:40:46,559 [main] org.mule.util.queue.QueueXaResourceManager: Started ResourceManager
[org.mule.munit.remote.CoverageManager]Coverage report calculation failed -
java.lang.RuntimeException: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig#68b7d0ef
at org.mule.munit.runner.simple.MunitSimpleRunner.run(MunitSimpleRunner.java:54)
at org.mule.munit.remote.path.ApplicationPathBuilder.buildApplicationPaths(ApplicationPathBuilder.java:80)
at org.mule.munit.remote.path.ApplicationPathBuilder.getFlowPaths(ApplicationPathBuilder.java:41)
.....
Caused by: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig#68b7d0ef
at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:249)
at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:99)
at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:71)
.....
... 6 more
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
.....
... 22 more
[org.mule.munit.remote.RemoteRunner]Done
[INFO] Printing Coverage Report...
[INFO]
[INFO] MUnit Coverage Summary
[INFO]
[INFO] * Resources: 0 - Flows: 0 - Message Processors: 0
[INFO] * Application Coverage: N/A
[INFO]
[INFO] MUnit Run Summary
[INFO]
[INFO] >> inventoryService-apikit-test.xml test result: Tests: 0, Errors: 0, Failures:0, Skipped: 0 <<< ERROR
[INFO] >> inventoryService-apikit-exception-test.xml test result: Tests: 0, Errors: 0, Failures:0, Skipped: 0 <<< ERROR
[INFO]
[INFO] > Tests: 0
[INFO] > Errors: 0
[INFO] > Failures: 0
[INFO] > Skipped: 0
[INFO]
[INFO] BUILD FAILURE
[INFO] Total time: 11.421 s
[INFO] Finished at: 2018-02-15T11:40:47-06:00
[INFO] Final Memory: 27M/266M
[INFO]
[ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.3.4:test (test) on project inventoryService: Build Fail: MUnit Tests Failed -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] Scanning for projects...
[INFO]
[INFO] Building Domain muledomain Project 1.0.0-SNAPSHOT
[INFO]
[INFO] --- mule-domain-maven-plugin:1.2:attach-test-resources (default-attach-test-resources) # muledomain ---
[INFO] attaching test resource C:\Users\user\AnypointStudio\BPMtoMulesoft\muledomain\src\main\app
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # muledomain ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] --- mule-domain-maven-plugin:1.2:filter-resources (default-filter-resources) # muledomain ---
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # muledomain
[INFO] No sources to compile
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # muledomain ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\user\AnypointStudio\BPMtoMulesoft\muledomain\src\test\resources
[INFO] skip non existing resourceDirectory C:\Users\user\AnypointStudio\BPMtoMulesoft\muledomain\src\main\app
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # muledomain ---
[INFO] No sources to compile
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # muledomain ---
[INFO] No tests to run.
[INFO]
[INFO] BUILD SUCCESS
[INFO]
[INFO] Total time: 1.770 s
[INFO] Finished at: 2018-02-15T11:40:50-06:00
[INFO] Final Memory: 12M/145M
[INFO]
... I have spent a good amount of time researching the errors, but much of what I've found that others had was missing dependencies, which I seem to already have in my pom file.
What could be the issue? Any suggestions appreciated.

Based on the log you provided, I observed 2 main errors:
#1
nested exception is java.lang.RuntimeException: Property mule.env could not be found
Solution: cross check whether you have configured mule.env=dev based on your environment(dev/test/prod).
#2
Caused by: java.net.BindException: Address already in use: bind
Solution: If you are using multiple HTTP connectors with the same port number, or if you are using a port which is occupied by some other s/w in your system then you will get this BindException. Try a different port number, e.g. 2018.

<munit:config name="munit" doc:name="MUnit configuration" mock-connectors="false" mock-inbounds="false" />
please update you Munit XML with above line, it should work!!

Related

Spring-Boot project build fails if stored on Desktop MacOS

If I am trying to run my SpringBoot project while it is stored in any folder located on Desktop on my MacBook - build fails.
If I move project to any other directory except Desktop - it builds fine.
What can be the reason?
Error message after maven clean - install:
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # my-blog-springboot-v1 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest
17:49:32.502 [main] DEBUG org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [AccountRepositoryTest]: using SpringBootContextLoader
17:49:32.508 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: no resource found for suffixes {-context.xml, Context.groovy}.
17:49:32.509 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: AccountRepositoryTest does not declare any static, non-private, non-final, nested classes annotated with #Configuration.
17:49:32.804 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray
17:49:32.805 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray
17:49:32.806 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua
17:49:32.807 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.012 s <<< FAILURE! - in ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests
[ERROR] ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests Time elapsed: 0.012 s <<< ERROR!
java.lang.IllegalStateException: Unable to find a #SpringBootConfiguration, you need to use #ContextConfiguration or #SpringBootTest(classes=...) with your test
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MyBlogSpringbootV1ApplicationTests » IllegalState Unable to find a #SpringBoot...
[ERROR] AccountControllerTest » IllegalState Unable to find a #SpringBootConfiguration...
[ERROR] AccountRepositoryTest » IllegalState Unable to find a #SpringBootConfiguration...
[ERROR] AccountServiceImplUnitTest » IllegalState Unable to find a #SpringBootConfigur...
[ERROR] MyUserDetailsServiceImplUnitTest » IllegalState Unable to find a #SpringBootCo...
[ERROR] PostServiceImpUnitTest » IllegalState Unable to find a #SpringBootConfiguratio...
[ERROR] RoleServiceImplUnitTest » IllegalState Unable to find a #SpringBootConfigurati...
[INFO]
[ERROR] Tests run: 7, Failures: 0, Errors: 7, Skipped: 0
[INFO]

maven-release plugin fails to create a release if parent pom uses ranges

I have a single module project, which I can create releases using maven-release-plugin
16:13:52 [INFO] Run maven with 'release:prepare release:perform -B -U -e -Dresume=false'
...
16:13:56 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
16:13:56 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-release-plugin:2.5.3:prepare (default-cli) # my-srv ---
16:13:57 [main] INFO org.apache.maven.shared.release.phase.ScmCheckModificationsPhase - Verifying that there are no local modifications...
16:13:57 [main] INFO org.apache.maven.shared.release.phase.ScmCheckModificationsPhase - ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
16:13:57 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Executing: cmd.exe /X /C "git rev-parse --show-prefix"
16:13:57 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Working directory: d:\jenkins\tools\ci-home\workspace\my-srv_master
16:13:57 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Executing: cmd.exe /X /C "git status --porcelain ."
16:13:57 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Working directory: d:\jenkins\tools\ci-home\workspace\my-srv_master
16:13:57 [Thread-4] WARNING org.apache.maven.scm.manager.plexus.DefaultScmManager - Ignoring unrecognized line: ?? effective-pom.xml
16:13:57 [main] INFO org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase - Checking dependencies and plugins for snapshots ...
16:13:57 [main] INFO org.apache.maven.shared.release.phase.RewritePomsForReleasePhase - Transforming 'WS-Proxy'...
16:13:57 [main] INFO org.apache.maven.shared.release.phase.GenerateReleasePomsPhase - Not generating release POMs
16:13:57 [main] INFO org.apache.maven.shared.release.phase.RunPrepareGoalsPhase - Executing goals 'clean verify'...
16:13:59 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Scanning for projects...
16:13:59 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO]
16:13:59 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] --------------< com.mycompany.services:my-srv >---------------
16:13:59 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Building WS-Proxy 1.8.13
16:13:59 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] --------------------------------[ pom ]---------------------------------
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO]
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # my-srv ---
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Deleting D:\jenkins\tools\ci-home\workspace\my-srv_master\target
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO]
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] --- buildnumber-maven-plugin:1.4:create (create-buildnumber) # my-srv ---
16:14:00 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Change the default 'git' provider implementation to 'jgit'.
16:14:01 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Storing buildNumber: 31a2d2bb9470473ed8cb36d0493377ad6e8a5103 at timestamp: 1623680040903
16:14:01 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] Storing buildScmBranch: master
16:14:01 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO]
16:14:01 [Thread-6] INFO org.apache.maven.shared.release.exec.InvokerMavenExecutor - [INFO] --- buildnumber-maven-plugin:1.4:create-timestamp (create-timestamp) # my-srv ---
...
I use a fixed version for the parent pom
...
<parent>
<groupId>com.mycompany.services</groupId>
<artifactId>parent</artifactId>
<version>0.5.0</version>
</parent>
<artifactId>my-srv</artifactId>
<packaging>pom</packaging>
<version>1.8.14-SNAPSHOT</version>
...
No we actually want to use version ranges for the parent
...
<parent>
<groupId>com.mycompany.services</groupId>
<artifactId>parent</artifactId>
<version>[0.5.0,0.7.0)</version>
</parent>
<artifactId>my-srv</artifactId>
<packaging>pom</packaging>
<version>1.8.12-SNAPSHOT</version>
...
However, this now fails as follows
10:58:54 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
10:58:54 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-release-plugin:2.5.3:prepare (default-cli) # my-srv ---
10:58:54 [main] INFO org.apache.maven.shared.release.phase.ScmCheckModificationsPhase - Verifying that there are no local modifications...
10:58:54 [main] INFO org.apache.maven.shared.release.phase.ScmCheckModificationsPhase - ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
10:58:54 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Executing: cmd.exe /X /C "git rev-parse --show-prefix"
10:58:54 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Working directory: d:\jenkins\tools\ci-home\workspace\my-srv_master
10:58:55 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Executing: cmd.exe /X /C "git status --porcelain ."
10:58:55 [main] INFO org.apache.maven.scm.manager.plexus.DefaultScmManager - Working directory: d:\jenkins\tools\ci-home\workspace\my-srv_master
10:58:55 [Thread-4] WARNING org.apache.maven.scm.manager.plexus.DefaultScmManager - Ignoring unrecognized line: ?? effective-pom.xml
10:58:55 [main] INFO org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase - Checking dependencies and plugins for snapshots ...
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 2.863 s
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2021-06-21T10:58:55+02:00
10:58:55 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:58:55 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project my-srv: Can't release project due to non released dependencies :
10:58:55 [main] ERROR org.apache.maven.cli.MavenCli - com.mycompany.services:parent:pom:0.6.1-SNAPSHOT
10:58:55 [main] ERROR org.apache.maven.cli.MavenCli - in project 'WS-Proxy' (com.mycompany.services:my-srv:pom:1.8.12-SNAPSHOT)
10:58:55 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1]
10:58:55 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project my-srv: Can't release project due to non released dependencies :
10:58:55 com.mycompany.services:parent:pom:0.6.1-SNAPSHOT
10:58:55 in project 'WS-Proxy' (com.mycompany.services:my-srv:pom:1.8.12-SNAPSHOT)
I understand that the dependency com.mycompany.services:parent:pom:0.6.1-SNAPSHOT is a SNAPSHOT but why. According to Dependency Mediation and Conflict Resolution
Resolution of dependency ranges should not resolve to a snapshot (development version) unless it is included as an explicit boundary.
I addition, there is a release version com.mycompany.services:parent:pom:0.6.1 available.

Can't run my Springboot/Oracle application. Port problems

I'm trying to run my Springboot application. I need to connect to my Oracle database but I'm getting an error related to the port that it is installed on. It's an Oracle 11g Express Edition installation. Should I then change the port of my Oracle installation and if so, how?
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
2017-02-06 13:58:27.402 INFO 6432 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#45a48c09: startup date [Mon Feb 06 13:58:15 CET 2017]; root of context hierarchy
2017-02-06 13:58:27.404 INFO 6432 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-02-06 13:58:27.406 INFO 6432 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-02-06 13:58:27.406 INFO 6432 --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
Hibernate: drop table tmt.users cascade constraints
2017-02-06 13:58:27.516 ERROR 6432 --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000478: Unsuccessful: drop table tmt.users cascade constraints
Hibernate: drop sequence tmt.id_seq
2017-02-06 13:58:27.528 ERROR 6432 --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000478: Unsuccessful: drop sequence tmt.id_seq
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:527)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8080 failed to start
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.checkThatConnectorsHaveStarted(TomcatEmbeddedServletContainer.java:213)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:189)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:784)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:329)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1235)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1224)
at cz.nnit.TmtApplication.main(TmtApplication.java:14)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.689 s
[INFO] Finished at: 2017-02-06T13:58:27+01:00
[INFO] Final Memory: 56M/482M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.BUILD-SNAPSHOT:run (default-cli) on project tmt: An exception occurred while running. null: InvocationTargetException: Connector configured to listen on port 8080 failed to start -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
Solution to your Question
Two Possible ways
1. Please change your Oracle Port to some other Port like 8081 or 9080.
2. Change the Tomcat Port in Spring-Boot application properties file.
3. Add the below following lines in src/main/resources/application.properties
server.port=8081.
I had the same problem because i closed Eclipse suddenly with my springboot app still running and the JAVA process was still running in background. That's why the port was in use in my case.

JavaEE Selenium ChromeDriver

I am trying to execute selenium in an Stateless EJB timer service.
The steps made are :
1- I created Stateless EJB service
#Stateless
public class AutomaticSayHello {
private static final Logger logger = Logger.getLogger(AutomaticSayHello.class);
#EJB
private DefaultController defaultController;
#Resource
private TimerService timerService;
#Schedule(hour="*",minute="*/1",persistent=false)
public void automaticHelloService(){
try{
ChromeWrapper chWrapper = ChromeWrapper.getInstance();
chWrapper.get("http:://google.com");
}catch(Exception ex){
logger.info(ex.getMessage());
}
}
}
(In my project I have wrapped ChromeDriver in a class named ChromeWrapper in order to support some shortcut for some methods)
2- Imported existed selenium project in pom.xml file of the ejb project.
<dependencies>
<dependency>
<groupId>com.ozmuzik.remote</groupId>
<artifactId>remote-mobile</artifactId>
<version>0.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
When I deployed EJB to wildfly 10.1.0 server the maven got the following error:
[INFO] --- wildfly-maven-plugin:1.1.0.Alpha11:deploy (default-cli) # ozmuzik-test-server-ejb ---
Eyl 25, 2016 10:38:59 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.1.Final
Eyl 25, 2016 10:39:00 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.1.Final
Eyl 25, 2016 10:39:00 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.9.Final
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.176 s
[INFO] Finished at: 2016-09-25T10:39:00+03:00
[INFO] Final Memory: 19M/272M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:deploy (default-cli) on project ozmuzik-test-server-ejb: Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar\"
[ERROR] Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class com.ozmuzik.test.server.timer.AutomaticSayHello with ClassLoader ModuleClassLoader for Module \"deployment.ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar:main\" from Service Module Loader
[ERROR] Caused by: java.lang.NoClassDefFoundError: com/facebook/mobile/selenium/ChromeWrapper
[ERROR] Caused by: java.lang.ClassNotFoundException: com.mobile.selenium.ChromeWrapper from [Module \"deployment.ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar:main\" from Service Module Loader]"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"ozmuzik-test-server-ejb-0.0.1-SNAPSHOT.jar\".POST_MODULE"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}}}
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Any one explain the why this issue is occured ?
I also wonder how I execute some code which are not part of EJB its self?
For simplicity , my aim is to execute a service to crawl some information with selenium with automatic execution of ejb.

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