Build failure while pushing changes to openshift server - java

I'm trying to push my project to openshift server, it end up with this error while doing maven build on the server:
[INFO] Packaging webapp
[INFO] Assembling webapp [sani3ee] in [/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/target/sani3ee]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/webapp]
[INFO] Webapp assembled in [112 msecs]
[INFO] Building war: /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/webapps/ROOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.677s
[INFO] Finished at: Sat Mar 07 14:01:05 EST 2015
[INFO] Final Memory: 9M/139M
[INFO] ------------------------------------------------------------------------
Preparing build for deployment
Deployment id is c2062771
Activating deployment
Starting PHPMyAdmin cartridge
Starting MySQL 5.5 cartridge
Stopping jbossews cartridge
Sending SIGTERM to jboss:514412 ...
Stopping PHPMyAdmin cartridge
Waiting for stop to finish
Waiting for stop to finish
Stopping MySQL 5.5 cartridge
Repairing links for 1 deployments
Building git ref 'master', commit 0d1853f
Using Maven mirror /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-504.3.3.el6.x86_64", arch: "i386", family: "unix"
Found pom.xml... attempting to build with 'mvn --global-settings /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml clean package -Popenshift -DskipTests'
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Sani3ee 1.0.0-BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # sani3ee ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # sani3ee ---
[debug] execute contextualize
[WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # sani3ee ---
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[INFO] Compiling 58 source files to /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
/var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/java/com/itworx/sani3ee/dao/favorite/FavoriteDaoImpl.java:[84,51] error: diamond operator is not supported in -source 1.6
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.823s
[INFO] Finished at: Sat Mar 07 14:35:34 EST 2015
[INFO] Final Memory: 8M/113M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "openshift" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project sani3ee: Compilation failure
[ERROR] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/repo/src/main/java/com/itworx/sani3ee/dao/favorite/FavoriteDaoImpl.java:[84,51] error: diamond operator is not supported in -source 1.6
[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/MojoFailureException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/54f479214382ec83330000bd/jbossews
For more details about the problem, try running the command again with the '--trace' option.
I have no idea what's the problem here, I've been trying to fix this for a while now, it build fine on my local machine, also openshift recognized that it should be built using JDK 7, thanks in advance everyone :)
Edit: Here is the tomcat log, it shows that the application is deployed correctly I guess.
Mar 08, 2015 11:01:07 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:01:07 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:02:29 AM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 08, 2015 11:02:29 AM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 08, 2015 11:02:30 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/rh/mysql55/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Mar 08, 2015 11:02:31 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:02:31 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1867 ms
Mar 08, 2015 11:02:31 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 08, 2015 11:02:31 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Mar 08, 2015 11:02:31 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sun Mar 08 11:02:50 EDT 2015]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/config/BeanLocations.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/DataSource.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/Hibernate.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/hibernate.cfg.xml]
INFO : org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/properties/database.properties]
WARN : org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.itworx.sani3ee.model.Favorite
WARN : org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.itworx.sani3ee.model.Favorite
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 24507 ms
Mar 08, 2015 11:03:14 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 08, 2015 11:03:14 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Mar 08, 2015 11:03:14 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 08, 2015 11:03:14 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 43,453 ms
Mar 08, 2015 11:03:14 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 08, 2015 11:03:14 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 43689 ms
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 09, 2015 12:03:22 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 09, 2015 12:03:22 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:16 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 14, 2015 4:41:16 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Mar 14, 2015 4:41:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/rh/mysql55/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Mar 14, 2015 4:41:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2071 ms
Mar 14, 2015 4:41:18 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 14, 2015 4:41:18 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Mar 14, 2015 4:41:18 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sat Mar 14 16:41:38 EDT 2015]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/config/BeanLocations.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/DataSource.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/Hibernate.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/database/hibernate.cfg.xml]
INFO : org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/properties/database.properties]
WARN : org.hibernate.mapping.RootClass - HHH000038: Composite-id class does not override equals(): com.itworx.sani3ee.model.Favorite
WARN : org.hibernate.mapping.RootClass - HHH000039: Composite-id class does not override hashCode(): com.itworx.sani3ee.model.Favorite
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 6553 ms
Mar 14, 2015 4:41:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 14, 2015 4:41:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Mar 14, 2015 4:41:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 14, 2015 4:41:45 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54f479214382ec83330000bd/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 26,168 ms
Mar 14, 2015 4:41:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.7.36.1-8080"]
Mar 14, 2015 4:41:45 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 26418 ms

Looks like you are probably missing the "openshift" profile in your pom.xml file. You can see an example of it here:
https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-jbossas/versions/7/template/pom.xml
You need to have that in your pom.xml if you are deploying from source with a git push, or openshift won't know how to deploy the .war file that it builds.
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app will need. -->
<!-- By default that is to put the resulting archive into the 'deployments' folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>{APP_NAME}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Related

Not able to run spring web socket demo

I am trying to run a demo of spring web socket but not able to test it completely. I am using java 7 and tomcat 7.0.50. I don't get any error while server startup, but when I open the web page with js making the connection to it I got 404 page not found. I am not sure if I am missing anything in configuration to make it run and how can I be able to connect it from js side.
I have following xml file:
<beans ....>
<context:annotation-config />
<websocket:message-broker
application-destination-prefix="/app">
<websocket:stomp-endpoint path="/hello">
<websocket:sockjs />
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" />
</websocket:message-broker>
</beans>
My controller class is:
#Controller
public class SwsService {
#MessageMapping("/hello")
#SendTo("/topic/greetings")
public Greeting greeting(HelloMessage message) throws Exception {
return new Greeting("Hello, " + message.getName() + "!");
}
public String getGreeting() {
return "Hello, you are in!";
}
}
The js from which I am calling this is:
var sock = new SockJS("/hello");
sock.onopen = function () {
console.log("open");
};
sock.onclose = function () {
console.log("closed");
};
sock.onmessage = function (message) {
console.log("msg", message);
};
The console output when I run the tomcat:
Feb 19, 2014 3:28:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\TortoiseGit\bin;C:\Python24;C:\Program Files\TortoiseSVN\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\harsh\AppData\Roaming\npm;E:\IDE\eclipse_indigo;;.
Feb 19, 2014 3:28:47 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SWS' did not find a matching property.
Feb 19, 2014 3:28:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 19, 2014 3:28:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Feb 19, 2014 3:28:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1412 ms
Feb 19, 2014 3:28:48 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 19, 2014 3:28:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
Feb 19, 2014 3:28:51 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Feb 19, 2014 3:28:51 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Feb 19, 2014 3:28:51 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Feb 19, 2014 3:28:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Wed Feb 19 15:28:51 IST 2014]; root of context hierarchy
Feb 19, 2014 3:28:52 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/conf/SwsContext.xml]
Feb 19, 2014 3:28:53 PM org.springframework.scheduling.concurrent.ExecutorConfigurationSupport initialize
INFO: Initializing ExecutorService 'clientInboundChannelExecutor'
Feb 19, 2014 3:28:53 PM org.springframework.scheduling.concurrent.ExecutorConfigurationSupport initialize
INFO: Initializing ExecutorService 'clientOutboundChannelExecutor'
Feb 19, 2014 3:28:53 PM org.springframework.scheduling.concurrent.ExecutorConfigurationSupport initialize
INFO: Initializing ExecutorService 'messageBrokerSockJsScheduler'
Feb 19, 2014 3:28:53 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/hello/**] onto handler of type [class org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler]
Feb 19, 2014 3:28:53 PM org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup start
INFO: Starting beans in phase 2147483647
Feb 19, 2014 3:28:53 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 2173 ms
Feb 19, 2014 3:28:53 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Feb 19, 2014 3:28:53 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Feb 19, 2014 3:28:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5842 ms
The browser console output:
GET http://localhost:8080/hello/info 404 (Not Found) sockjs-0.3.min.js:27
closed
How can I successfully test it?
Updates
I also tried running the portfolio example from here: https://github.com/rstoyanchev/spring-websocket-portfolio as suggested by #jhadesdev
But it also doesn't help. When I run mvn tomcat7:run, I see following output and open url on browser tells 404.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea
ded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-websocket-portfolio 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) # spring-websocket-portfol
io >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # spring-web
socket-portfolio ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\libraries\spring-websocket-portfol
io\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # spring-websoc
ket-portfolio ---
[INFO] No sources to compile
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) # spring-websocket-portfol
io <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # spring-websocket-portfol
io ---
[INFO] Running war on http://localhost:8080/spring-websocket-portfolio
[INFO] Using existing Tomcat server configuration at E:\libraries\spring-websock
et-portfolio\target\tomcat
[INFO] create webapp with contextPath: /spring-websocket-portfolio
Feb 27, 2014 10:20:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 27, 2014 10:20:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Feb 27, 2014 10:20:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Feb 27, 2014 10:20:49 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Feb 27, 2014 10:20:49 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
It stuck there and doesn't go ahead.
I was facing the same problem. This thread gave me enough clues to solve the problem. Thanks a lot.
SOLUTION:
In case you have a Spring MVC Dispatcher Servlet configured in your web.xml and mapped to a url-pattern as shown below
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/webui/*</url-pattern>
</servlet-mapping>
Then you have to create the SockJS instance as shown below
var socket = new SockJS('/contextPath/webui/hello');
NOTE: Replace contextPath with your application context path.
This Chrome extension can help you test Websockets.
Also you can have a look at my simple-chat project that uses Spring Boot with Websockets.
Try adding an assets folder inside webapp, where all the stomp and sockjs.js files are made available. Have a look at this example of a running application, that can be run with mvn clean install jetty:run.
The problem seems to be that either the sockjs is not on the server or some path is wrong. Based on the example on the link, a stomp endpoint can be configured like this:
#EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
#Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/portfolio").withSockJS();
}
}
Then in javascript the end point can be called like this:
var socket = new SockJS('/spring-websocket-portfolio/portfolio')
var stompClient = Stomp.over(socket);
where /spring-websocket-portfolio is the root deployment path of your application.
Your application looks fine.
You should definitely prefix JavaScript requests with the root context of your application, as jhadesdev mentioned.
Does your application registers additional filters or customize messageconverters? Maybe some other element of configuration is interfering here.
The latest portfolio example should definitely work, here are some questions:
Could you tell us more about your client setup (browser, version)?
Does your browser support websocket (test it there)?
Could you also try in incognito mode (maybe a 3rd party browser extension is at fault here)?
Could you check that your browser is not using a HTTP proxy for localhost requests?
Could you check if this HTTP 404 is in Tomcat access log? (and see if you've got something interesting in those or in catalina.out?)
How is your DispatcherServlet mapped? Here might be what you're looking for
I solved this problem in thats way:
when you create the SockJS add localhost:8080/
like this
new SockJS('http://localhost:8080/spring-websocket-portfolio/portfolio')
For me the solution was to enable SockJS in by WebSocketConfig class:
#Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/search")
.setAllowedOrigins("*")
.setHandshakeHandler(new DefaultHandshakeHandler())
.withSockJS();
}

How to inject a #Named bean into a Junit test

I'm trying to inject a #Named bean into a Junit test.
This works in my ejb module, but the same approach in my war module fails.
I'd like to know why I get org.apache.openejb.OpenEJBException: Creating application failed: couldn't start owb context.
I know this looks like the same issue as in Issue with EJB 3.1 injected with CDI bean while running JUnit, but it can't be the same as it works in another module.
The source code is here: https://github.com/Crydust/guestbook
Working test: guestbook/guestbook-ejb/src/test/java/be/crydust/guestbook/ejb/PostBoundaryTest.java
Failing test: guestbook/guestbook-web/src/test/java/be/crydust/guestbook/web/PostBackingTest.java
Source of failing test (imports ommitted):
public class PostBackingTest {
private static EJBContainer ejbContainer;
#Inject
PostBacking cut;
#BeforeClass
public static void startTheContainer() {
ejbContainer = EJBContainer.createEJBContainer();
}
#Before
public void setUp() throws Exception {
ejbContainer.getContext().bind("inject", this);
}
#AfterClass
public static void afterClass() {
if (ejbContainer != null) {
ejbContainer.close();
}
}
// FIXME injection fails
#Test
public void testInjected() {
assertThat(cut, is(not(nullValue())));
}
}
Log of failing test:
cd D:\home\kristof\Projects\guestbook\guestbook-web; JAVA_HOME=C:\\opt\\Java\\jdk1.7.0_45 cmd /c "\"\"C:\\opt\\NetBeans 7.4\\java\\maven\\bin\\mvn.bat\" -Dmaven.ext.class.path=\"C:\\opt\\NetBeans 7.4\\java\\maven-nblib\\netbeans-eventspy.jar\" test\""
Scanning for projects...
------------------------------------------------------------------------
Building guestbook-web 1.0-SNAPSHOT
------------------------------------------------------------------------
--- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (prepare-agent) # guestbook-web ---
surefireArgLine set to -javaagent:D:\home\kristof\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\home\kristof\Projects\guestbook\guestbook-web\target\jacoco.exec
--- maven-resources-plugin:2.5:resources (default-resources) # guestbook-web ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource
--- maven-dependency-plugin:2.8:copy (copy) # guestbook-web ---
Configured Artifact: org.apache.openejb:openejb-javaagent:4.6.0:jar
org.apache.openejb:openejb-javaagent:4.6.0:jar already exists in D:\home\kristof\Projects\guestbook\guestbook-web\target
--- maven-compiler-plugin:3.1:compile (default-compile) # guestbook-web ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.5:testResources (default-testResources) # guestbook-web ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\home\kristof\Projects\guestbook\guestbook-web\src\test\resources
--- maven-compiler-plugin:3.1:testCompile (default-testCompile) # guestbook-web ---
Nothing to compile - all classes are up to date
--- maven-surefire-plugin:2.16:test (default-test) # guestbook-web ---
Surefire report directory: D:\home\kristof\Projects\guestbook\guestbook-web\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
-------------------------------------------------------
T E S T S
-------------------------------------------------------
98 classpath-bootstrap INFO [main] openjpa.Runtime - OpenJPA dynamically loaded a validation provider.
Running be.crydust.guestbook.web.PostBackingTest
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: OpenEJB http://openejb.apache.org/
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Startup: Tue Dec 17 12:16:48 CET 2013
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Copyright 1999-2013 (C) Apache OpenEJB Project, All Rights Reserved.
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Version: 4.6.0
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build date: 20131117
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build time: 06:49
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.home = D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.base = D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl#31185f32
dec 17, 2013 12:16:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Succeeded in installing singleton service
dec 17, 2013 12:16:48 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'javax.ejb.embeddable.EJBContainer=true'
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigUtils searchForConfiguration
INFO: Cannot find the configuration file [conf/openejb.xml]. Will attempt to create one for the beans deployed.
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
dec 17, 2013 12:16:48 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
dec 17, 2013 12:16:48 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Default Security Service)
dec 17, 2013 12:16:48 PM org.apache.openejb.config.DeploymentsResolver processUrls
INFO: Found PersistenceModule in classpath: d:\home\kristof\.m2\repository\be\crydust\guestbook-entities\1.0-snapshot\guestbook-entities-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.DeploymentsResolver processUrls
INFO: Found EjbModule in classpath: d:\home\kristof\.m2\repository\be\crydust\guestbook-ejb\1.0-snapshot\guestbook-ejb-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory loadApplication
INFO: Beginning load: d:\home\kristof\.m2\repository\be\crydust\guestbook-entities\1.0-snapshot\guestbook-entities-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory loadApplication
INFO: Beginning load: d:\home\kristof\.m2\repository\be\crydust\guestbook-ejb\1.0-snapshot\guestbook-ejb-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb PostBoundary: EjbDeployment(deployment-id=PostBoundary)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean guestbook-ejb-1.0-SNAPSHOT.Comp577600423: Container(type=MANAGED, id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.core.managed.SimplePassivater init
INFO: Using directory C:\Users\kristof\AppData\Local\Temp for stateful session passivation
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean PostBoundary: Container(type=STATELESS, id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring PersistenceUnit(name=guestbookPU)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig logAutoCreateResource
INFO: Auto-creating a Resource with id 'Default JDBC Database' of type 'DataSource for 'guestbookPU'.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=Default JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Unmanaged JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig logAutoCreateResource
INFO: Auto-creating a Resource with id 'Default Unmanaged JDBC Database' of type 'DataSource for 'guestbookPU'.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=Default Unmanaged JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit guestbookPU <jta-data-source> to Resource ID 'Default JDBC Database' from 'null'
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig setNonJtaDataSource
INFO: Adjusting PersistenceUnit guestbookPU <non-jta-data-source> to Resource ID 'Default Unmanaged JDBC Database' from 'null'
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "D:\home\kristof\Projects\guestbook\guestbook-web\target" loaded.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM null
INFO: OpenJPA dynamically loaded a validation provider.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
INFO: PersistenceUnit(name=guestbookPU, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 12ms
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.JndiBuilder bindJava
INFO: Jndi(name="java:global/guestbook-ejb-1.0-SNAPSHOT/PostBoundary!be.crydust.guestbook.ejb.PostBoundary")
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.JndiBuilder bindJava
INFO: Jndi(name="java:global/guestbook-ejb-1.0-SNAPSHOT/PostBoundary")
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl#31185f32
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
dec 17, 2013 12:16:49 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
SEVERE: CDI Beans module deployment failed
org.apache.webbeans.exception.inject.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [be.crydust.guestbook.web.PostBacking] is not found with the qualifiers
Qualifiers: [#javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name : cut, Bean Owner : [PostBackingTest, Name:null, WebBeans Type:ENTERPRISE, API Types:[be.crydust.guestbook.web.PostBackingTest,java.lang.Object,java.io.Serializable], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:213)
at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:187)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:162)
at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:799)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
at be.crydust.guestbook.web.PostBackingTest.startTheContainer(PostBackingTest.java:31)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [be.crydust.guestbook.web.PostBacking] is not found with the qualifiers
Qualifiers: [#javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name : cut, Bean Owner : [PostBackingTest, Name:null, WebBeans Type:ENTERPRISE, API Types:[be.crydust.guestbook.web.PostBackingTest,java.lang.Object,java.io.Serializable], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
at org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:195)
at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:954)
at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:470)
at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:420)
at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:200)
... 25 more
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyApplication
INFO: Undeploying app: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: Default JDBC Database
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: Default Unmanaged JDBC Database
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.458 sec <<< FAILURE! - in be.crydust.guestbook.web.PostBackingTest
be.crydust.guestbook.web.PostBackingTest Time elapsed: 1.458 sec <<< ERROR!
org.apache.openejb.OpenEjbContainer$AssembleApplicationException: org.apache.openejb.OpenEJBException: Creating application failed: D:\home\kristof\Projects\guestbook\guestbook-web\target: couldn't start owb context
at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
at org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:195)
at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:954)
at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:470)
at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:420)
at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:200)
at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:187)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:162)
at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:799)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
at be.crydust.guestbook.web.PostBackingTest.startTheContainer(PostBackingTest.java:31)
Results :
Tests in error:
PostBackingTest.startTheContainer:31 ยป AssembleApplication org.apache.openejb....
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.595s
Finished at: Tue Dec 17 12:16:49 CET 2013
Final Memory: 17M/224M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project guestbook-web: There are test failures.
Please refer to D:\home\kristof\Projects\guestbook\guestbook-web\target\surefire-reports for the individual test results.
-> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I use the needle framework for these kind of tests. It automatically injects mocks that you can configure the usual way, but also can be used to inject real instances if needed (for collaboration/integration testing).
You can find it here: http://needle.spree.de/
I believe OpenEJB expects the beans.xml in META-INF folder, although the war should have it it in the WEB-INF folder. Can you verify this by creating a empty beans.xml in test/resources/META-INF folder?

Deployed to Tomcat 7 OK but cannot access application

I have a CI-deployed Java Wicket application using Jenkins -> Tomcat 7 on a server. All seems fine up until the point I try to access the application through a browser (via the listing of the deployed application in the manager app). Then I get a 404 error. In the logs, I can see from the tomcat7-stdout-.log that the application starts up fine - the spring beans I set up are outputting init debug statements from my code, so it looks ready to go with no errors.
My dev machine is 32-bit win7. The server is 64-bit Win Server 2008 R2
Thinking it might have been the way Jenkins builds the war file, or an incompatibility between 32/64-bit versions, I installed Tomcat 7 locally so it's all on the same machine, and I get the same result when I deploy from the manager application.
When I shut down tomcat and try to access localhost:8080, nothing appears so there is no other apps competing for that port that I can see
Creating a META-INF/context.xml with <Context path="/system4" /> inside doesn't affect the deployment either (ie it still says it's at the path specified by the war name).
I followed the instructions here to remove some error listenerStart issues, but the log file created is empty
Running locally via mvn jetty:run starts the app with no problems. I can then navigate to the app successfully on localhost:8080
There are no errors in the log files. Below is the total output from each file from a (local) deployment.
localhost..log:
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#46128d')
localhost_access_log.log:
127.0.0.1 - tomcatgui [01/Jul/2013:11:48:11 +0100] "GET /manager/html/list?org.apache.catalina.filters.CSRF_NONCE=DBBBE417970CCAAB039E98C236CB177A HTTP/1.1" 200 15822
127.0.0.1 - tomcatgui [01/Jul/2013:11:48:11 +0100] "GET /manager/images/asf-logo.gif HTTP/1.1" 304 -
127.0.0.1 - tomcatgui [01/Jul/2013:11:48:11 +0100] "GET /manager/images/tomcat.gif HTTP/1.1" 304 -
127.0.0.1 - tomcatgui [01/Jul/2013:11:48:16 +0100] "GET /manager/html/list?org.apache.catalina.filters.CSRF_NONCE=634AA4131BBA0B7368023C32CD653FC8 HTTP/1.1" 200 15822
127.0.0.1 - tomcatgui [01/Jul/2013:11:48:34 +0100] "POST /manager/html/upload?org.apache.catalina.filters.CSRF_NONCE=AA80212A2557D18475CB621F165BD24E HTTP/1.1" 200 17716
host-manager..log (empty)
catalina..log:
Jul 01, 2013 11:47:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.27 using APR version 1.4.6.
Jul 01, 2013 11:47:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1d 5 Feb 2013)
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1152 ms
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.41
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\docs
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\examples
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\host-manager
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\manager
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\ROOT
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 440 ms
Jul 01, 2013 11:48:25 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\apache-tomcat-7.0.41\webapps\system4-ui-0.0.1-SNAPSHOT.war
servlet-examples..log (the one suggested in the link) (empty - the logging level is set to ALL)
manager..log:
Jul 01, 2013 11:48:11 AM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'
Jul 01, 2013 11:48:11 AM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Global resources are available
Jul 01, 2013 11:48:11 AM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Jul 01, 2013 11:48:16 AM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Jul 01, 2013 11:48:34 AM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Output from the tomcat window:
Jul 01, 2013 11:47:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.27 using APR version 1.4
.6.
Jul 01, 2013 11:47:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], ra
ndom [true].
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.AprLifecycleListener initializ
eSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1d 5 Feb 2013)
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1152 ms
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 01, 2013 11:47:58 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.41
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\docs
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\exampl
es
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\host-m
anager
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\manage
r
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.41\webapps\ROOT
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Jul 01, 2013 11:47:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Jul 01, 2013 11:47:58 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 440 ms
Jul 01, 2013 11:48:25 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\apache-tomcat-7.0.41\webapps\system4-
ui-0.0.1-SNAPSHOT.war
Jul 01, 2013 11:48:31 AM org.apache.catalina.core.StandardContext listenerStart
FINE: Sending application start events
Jul 01, 2013 11:48:31 AM org.apache.catalina.core.StandardContext filterStart
FINE: Starting filters
Jul 01, 2013 11:48:31 AM org.apache.catalina.core.StandardContext filterStart
FINE: Starting filter 'wicket.system4-ui'
INFO - WebXmlFile - web.xml: url mapping found for filter with
name wicket.system4-ui: [/*]
INFO - Application - [wicket.system4-ui] init: Wicket core libra
ry initializer
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=IBehaviorListener, method=public abstract void org.apache.wick
et.behavior.IBehaviorListener.onRequest()]
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=IFormSubmitListener, method=public abstract void org.apache.wi
cket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=ILinkListener, method=public abstract void org.apache.wicket.m
arkup.html.link.ILinkListener.onLinkClicked()]
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=IOnChangeListener, method=public abstract void org.apache.wick
et.markup.html.form.IOnChangeListener.onSelectionChanged()]
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=IRedirectListener, method=public abstract void org.apache.wick
et.IRedirectListener.onRedirect()]
INFO - RequestListenerInterface - registered listener interface [RequestListe
nerInterface name=IResourceListener, method=public abstract void org.apache.wick
et.IResourceListener.onResourceRequested()]
INFO - Application - [wicket.system4-ui] init: Wicket extensions
initializer
INFO - sPathXmlApplicationContext - Refreshing org.springframework.context.supp
ort.ClassPathXmlApplicationContext#19b35e1: startup date [Mon Jul 01 11:48:32 BS
T 2013]; root of context hierarchy
INFO - XmlBeanDefinitionReader - Loading XML bean definitions from class pat
h resource [META-INF/applicationContext-data.xml]
INFO - sPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation fou
nd and supported for component scanning
INFO - nnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation fo
und and supported for autowiring
INFO - sPathXmlApplicationContext - Bean 'org.springframework.orm.jpa.vendor.Hi
bernateJpaVendorAdapter#5d2d9b' of type [class org.springframework.orm.jpa.vendo
r.HibernateJpaVendorAdapter] is not eligible for getting processed by all BeanPo
stProcessors (for example: not eligible for auto-proxying)
INFO - sPathXmlApplicationContext - Bean 'org.springframework.instrument.classl
oading.InstrumentationLoadTimeWeaver#f003c0' of type [class org.springframework.
instrument.classloading.InstrumentationLoadTimeWeaver] is not eligible for getti
ng processed by all BeanPostProcessors (for example: not eligible for auto-proxy
ing)
INFO - erEntityManagerFactoryBean - Building JPA container EntityManagerFactory
for persistence unit 'com.sw.system4.core.persistence'
INFO - Version - HCANN000001: Hibernate Commons Annotations
{4.0.1.Final}
INFO - Version - HHH000412: Hibernate Core {4.2.0.Final}
INFO - Environment - HHH000206: hibernate.properties not found
INFO - Environment - HHH000021: Bytecode provider name : javassi
st
INFO - Ejb3Configuration - HHH000204: Processing PersistenceUnitInfo [
name: com.sw.system4.core.persistence
...]
INFO - agerConnectionProviderImpl - HHH000402: Using Hibernate built-in connect
ion pool (not for production use!)
INFO - agerConnectionProviderImpl - HHH000115: Hibernate connection pool size:
20
INFO - agerConnectionProviderImpl - HHH000006: Autocommit mode: true
INFO - agerConnectionProviderImpl - HHH000401: using driver [com.mysql.jdbc.Dri
ver] at URL [jdbc:mysql://localhost:3306/system4_live]
INFO - agerConnectionProviderImpl - HHH000046: Connection properties: {user=sys
tem4_user, password=****, autocommit=true, release_mode=auto}
INFO - Dialect - HHH000400: Using dialect: org.hibernate.dia
lect.MySQL5Dialect
INFO - ransactionFactoryInitiator - HHH000268: Transaction strategy: org.hibern
ate.engine.transaction.internal.jdbc.JdbcTransactionFactory
INFO - ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO - SchemaUpdate - HHH000228: Running hbm2ddl schema update
INFO - SchemaUpdate - HHH000102: Fetching database metadata
INFO - SchemaUpdate - HHH000396: Updating schema
INFO - TableMetadata - HHH000261: Table found: system4_live.user
INFO - TableMetadata - HHH000037: Columns: [id, enabled, username,
preferences_id, lastlogin, lastname, firstname, password, changepasswordrequire
d]
INFO - TableMetadata - HHH000108: Foreign keys: [fk285feb559233ea]
INFO - TableMetadata - HHH000126: Indexes: [primary, fk285feb55923
3ea]
INFO - TableMetadata - HHH000261: Table found: system4_live.userpr
eferences
INFO - TableMetadata - HHH000037: Columns: [id]
INFO - TableMetadata - HHH000108: Foreign keys: []
INFO - TableMetadata - HHH000126: Indexes: [primary]
INFO - SchemaUpdate - HHH000232: Schema update complete
INFO - sPathXmlApplicationContext - Bean 'entityManagerFactory' of type [class
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligi
ble for getting processed by all BeanPostProcessors (for example: not eligible f
or auto-proxying)
INFO - DefaultListableBeanFactory - Pre-instantiating singletons in org.springf
ramework.beans.factory.support.DefaultListableBeanFactory#66d804: defining beans
[entityManagerFactory,transactionManager,org.springframework.orm.jpa.support.Pe
rsistenceAnnotationBeanPostProcessor#0,org.springframework.aop.config.internalAu
toProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionA
ttributeSource#0,org.springframework.transaction.interceptor.TransactionIntercep
tor#0,org.springframework.transaction.config.internalTransactionAdvisor,persiste
nceExceptionTranslationPostProcessor,org.springframework.context.annotation.inte
rnalConfigurationAnnotationProcessor,org.springframework.context.annotation.inte
rnalAutowiredAnnotationProcessor,org.springframework.context.annotation.internal
RequiredAnnotationProcessor,org.springframework.context.annotation.internalCommo
nAnnotationProcessor,org.springframework.context.annotation.internalPersistenceA
nnotationProcessor,userJpaDAO,user-service,encryption-service,org.springframewor
k.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root
of factory hierarchy
INFO - MD5EncryptionStrategy - EncryptionStrategy: Using MD5 for encryptio
n
INFO - WebApplication - [wicket.system4-ui] Started Wicket version
6.8.0 in DEVELOPMENT mode
********************************************************************
*** WARNING: Wicket is running in DEVELOPMENT mode. ***
*** ^^^^^^^^^^^ ***
*** Do NOT deploy to your live server(s) without changing this. ***
*** See Application#getConfigurationType() for more information. ***
********************************************************************
If I click on the link for the app in the tomcat manager application, I get:
type Status report
message /system4%2Dui%2D0.0.1%2DSNAPSHOT/
description The requested resource is not available.
and this appears in localhost-access..log:
127.0.0.1 - - [01/Jul/2013:11:54:38 +0100] "GET /system4%2Dui%2D0.0.1%2DSNAPSHOT/ HTTP/1.1" 404 1015
Please can anyone help?
OK, well this is strange.
It was all down to the name of the WAR file, and thus the URL of the site. I renamed the war file to just system4.war, and tried to deploy that, and I could navigate to the URL just fine.
I say it's strange, because I ran the wicket quickstart project some months ago on the very same server, and the war file was named very similarly (ie wickettestproject-1.0-SNAPSHOT.war) and this worked ok, although after redeploying this project now, that no longer works either.
I'm at a loss as to why, because AFAIK dots and dashes are ok in a URL - maybe it's a tomcat quirk or something.
To fix the problem:
In the pom.xml I use to generate the WAR, I've included this line under the build tags:
<finalName>system4</finalName>
Now the war is renamed, it's built and deployed under system4.war, and accessed via <server>:<port>/system4

Cannot setup apache axis 2 with eclipse helios

Im trying to setup Apache Axis2 web services in eclipse, but im getting the following errors in my console. I followed this blog to setup a simple web service. But I seem to be missing something. I'm using windows 7 64bit.
Jan 07, 2013 2:57:33 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\bin;C:\Program Files (x86)\git\cmd;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Ruby193\bin;C:\Users\intern\AppData\Roaming\npm\;C:\Python27;C:\Python27\Lib\site- packages\django\bin;D:\shortcuts;C:\Python27\Scripts;C:\mongodb\bin;D:\shortcuts\ffmpg;C:\Program Files\Java\jdk1.7.0_10\bin;;.
Jan 07, 2013 2:57:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:myFirstWebService' did not find a matching property.
Jan 07, 2013 2:57:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MyWebService' did not find a matching property.
Jan 07, 2013 2:57:34 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 07, 2013 2:57:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 639 ms
Jan 07, 2013 2:57:34 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 07, 2013 2:57:34 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
[WARN] Web application uses org.apache.axis2.transport.http.AxisAdminServlet; please update web.xml to use org.apache.axis2.webapp.AxisAdminServlet instead
[INFO] Clustering has been disabled
[INFO] Deploying module: addressing-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/addressing-1.6.2.mar
[INFO] Deploying module: metadataExchange-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/mex-1.6.2.mar
[INFO] Deploying module: mtompolicy-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/mtompolicy-1.6.2.mar
[INFO] Deploying module: ping-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/ping-1.6.2.mar
[INFO] Deploying module: script-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/scripting-1.6.2.mar
[INFO] Deploying module: soapmonitor-1.6.2 - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/modules/soapmonitor-1.6.2.mar
[INFO] Deploying Web service: version.aar - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/services/version.aar
[INFO] Deploying Web service: WebService - file:/C:/Users/intern/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyWebService/WEB-INF/services/WebService/
[WARN] No transportReceiver for org.apache.axis2.transport.http.AxisServletListener found. An instance for HTTP will be configured automatically. Please update your axis2.xml file!
Jan 07, 2013 2:57:35 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 07, 2013 2:57:35 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jan 07, 2013 2:57:35 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Jan 07, 2013 2:57:35 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1706 ms
Jan 07, 2013 2:57:35 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:406)
at org.apache.catalina.startup.Catalina.await(Catalina.java:676)
at org.apache.catalina.startup.Catalina.start(Catalina.java:628)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jan 07, 2013 2:57:35 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jan 07, 2013 2:57:36 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jan 07, 2013 2:57:36 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/MyWebService] created a ThreadLocal with key of type [org.apache.axiom.util.UIDGenerator$1] (value [org.apache.axiom.util.UIDGenerator$1#29fbe6f8 ]) and a value of type [long[]] (value [[J#58f8b950]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Jan 07, 2013 2:57:37 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
I found out the problem. My Tomcat was running as a windows service and it was blocking the localhost port number at 8080. I had to disable the service and ran in eclipse it worked great :)

mvn tomcat:run terminates

When I call 'mvn tomcat:run' from my project, it starts up, then closes down immediately after a successful startup:
2011-01-18 13:02:10,636 INFO [org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'myProject': initialization completed in 2010 ms
Jan 18, 2011 1:02:10 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 18, 2011 1:02:10 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 minutes 26 seconds
[INFO] Finished at: Tue Jan 18 13:02:10 CET 2011
[INFO] Final Memory: 146M/274M
[INFO] ------------------------------------------------------------------------
2011-01-18 13:02:11,645 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Closing WebApplicationContext for namespace 'myProjectWS-servlet': startup date [Tue Jan 18 13:02:06 CET 2011]; parent: Root WebApplicationContext
Even running tomcat:run-war-only gives the same:
[INFO] Running war on http://localhost:8080/myProject
[INFO] Creating Tomcat server configuration at /Users/niklas/Documents/Eclipse/myProject/target/tomcat
Jan 18, 2011 1:19:21 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Jan 18, 2011 1:19:21 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Jan 18, 2011 1:19:22 PM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'myProject-SNAPSHOT' = [/Users/niklas/Documents/Eclipse/myProject/target/myProject-4.1.0-SNAPSHOT/]
Jan 18, 2011 1:19:22 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [/Users/niklas/Documents/Eclipse/myProject/target/myProject-4.1.0-SNAPSHOT/WEB-INF/classes/log4j.properties]
Jan 18, 2011 1:19:22 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jan 18, 2011 1:22:05 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'myProjectWS'
Jan 18, 2011 1:22:06 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'myProject'
Jan 18, 2011 1:22:08 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 18, 2011 1:22:08 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 56 seconds
[INFO] Finished at: Tue Jan 18 13:22:08 CET 2011
[INFO] Final Memory: 120M/226M
[INFO] ------------------------------------------------------------------------
Jan 18, 2011 1:22:09 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Any idea what could cause it to shut down right away? No System.exit's anywhere in the code
Cheers
Nik
One possible reason is if fork parameter is set to true.

Categories