Why are Spring log messages listed as [ERROR] when there seem to be no errors? - spring

I have a GWT/Spring application, building with Maven and the gwt-maven-plugin.
When I run
mvn gwt:run
the gwt-maven-plugin runs the application and everything starts up and runs fine. What's bothering me is that the log messages claim [ERROR] on every line even though there are no apparent errors, and no message ever says what the error might be.
My guess is that [ERROR] on every log line is from the gwt-maven-plugin, since what comes after seems to be Spring's log message like so... [ERROR] INFO:
and when I run the app with mvn jetty:run, I see only the INFO: part of the messages.
Attached is most of the log to standard out. Has anybody seen log output like this, or have any ideas about what could cause a plugin to log info messages as error messages?
[INFO] ------------------------------------------------------------------------
[INFO] Building GWT Maven Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gwt-maven-plugin:2.4.0:run (default-cli) # gwt >>>
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # gwt ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # gwt ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-war-plugin:2.1.1:exploded (default) # gwt ---
[INFO] Exploding webapp
[INFO] Assembling webapp [gwt] in [/home/jay/workspace/buildtimer/target/gwt-1.0- SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/jay/workspace/buildtimer/src/main/webapp]
[INFO] Webapp assembled in [169 msecs]
[INFO]
[INFO] <<< gwt-maven-plugin:2.4.0:run (default-cli) # gwt <<<
[INFO]
[INFO] --- gwt-maven-plugin:2.4.0:run (default-cli) # gwt ---
[INFO] create exploded Jetty webapp in /home/jay/workspace/buildtimer/target/gwt-1.0- SNAPSHOT
[INFO] auto discovered modules [com.buildtimer.Main]
[ERROR] Nov 14, 2011 7:38:44 PM org.springframework.web.context.ContextLoader initWebApplicationContext
[ERROR] INFO: Root WebApplicationContext: initialization started
[ERROR] Nov 14, 2011 7:38:44 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
[ERROR] INFO: Refreshing Root WebApplicationContext: startup date [Mon Nov 14 19:38:44 EST 2011]; root of context hierarchy
[ERROR] Nov 14, 2011 7:38:44 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
[ERROR] INFO: Loading XML bean definitions from class path resource [META- INF/applicationContext.xml]
[ERROR] Nov 14, 2011 7:38:44 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
[ERROR] INFO: Loading XML bean definitions from class path resource [META- INF/applicationContext-persistence.xml]
[ERROR] Nov 14, 2011 7:38:44 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
[ERROR] INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1e42c6e: defining beans [org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.ann otation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.T ransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,tr ansactionManager,buildDao,dataSource,sessionFactory]; root of factory hierarchy
[ERROR] Nov 14, 2011 7:38:45 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
[ERROR] INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[ERROR] Nov 14, 2011 7:38:46 PM org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
[ERROR] INFO: Building new Hibernate SessionFactory
[ERROR] Nov 14, 2011 7:38:48 PM org.springframework.orm.hibernate3.LocalSessionFactoryBean updateDatabaseSchema
[ERROR] INFO: Updating database schema for Hibernate SessionFactory
[ERROR] Nov 14, 2011 7:38:48 PM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
[ERROR] INFO: Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource#1b0e438] of Hibernate SessionFactory for HibernateTransactionManager
My web.xml logging configuration is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
...
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
...
</web-app>
my log4j.properties.xml file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="rootAppender" class="org.apache.log4j.FileAppender" >
<param name="file" value="app.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<priority value ="warn" />
<appender-ref ref="rootAppender" />
</root>
</log4j:configuration>

Not sure how much it is related, but your log indicates that the SLF4J logging framework is not properly initilaized
[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Make sure that you have all three dependencies in your pom (SLF4J, The log4j binding and log4j itself)
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
<version>1.2.16</version>
</dependency>

Related

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

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

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 GWT connect to superdevmode server in multi module maven project?

I recently changed my GWT + App Engine project setup from a single module maven project, to a multi module maven project:
My project builds using mvn install (on the parent) with no errors, and as long as the whole project has been compiled, it runs fine.
However, I need to have <superDevMode>false</superDevMode> in the configuration of the Mojo gwt-maven-plugin to do this. Here is some of my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt-maven-plugin.version}</version>
<configuration>
<strict>true</strict>
<testTimeOut>180</testTimeOut>
<!-- With multiple tests use GwtTestSuite.java for speed -->
<includes>**/*GwtTest.java</includes>
<mode>htmlunit</mode>
<logLevel>INFO</logLevel>
<style>PRETTY</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<appEngineVersion>${gae.version}</appEngineVersion>
<extraJvmArgs>-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=10 -Xmx2g -Dappengine.sdk.root=${mvn.gae.home}
</extraJvmArgs>
<!--<port>8888</port>-->
<superDevMode>false</superDevMode>
<!--<incremental>true</incremental>-->
<!--<bindAddress>0.0.0.0</bindAddress>-->
<runTarget>Project.html</runTarget>
<modules>
<module>com.utilitiessavings.usavappv7.Project</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
If I turn on SDM, I don't seem to get any errors when it starts up (using gwt:run):
[INFO] --- gwt-maven-plugin:2.8.0-rc1:run (default-cli) # UsavAppV7 ---
[INFO] create exploded Jetty webapp in C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT
[INFO] extract appengine 1.9.40 sdk to C:\Users\Drew\IntelliJ\UsavApp\app\target\appengine-sdk
[INFO] Super Dev Mode starting up
[INFO] workDir: C:\Users\Drew\AppData\Local\Temp\gwt-codeserver-4487617494656562585.tmp
[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Loading Java files in com.utilitiessavings.usavappv7.Project.
[INFO] Module setup completed in 16220 ms
[INFO]
[INFO] The code server is ready at http://127.0.0.1:9876/
[ERROR] Aug 16, 2016 4:35:26 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
[ERROR] INFO: Overwriting system property key 'java.util.logging.config.file', value 'C:\Users\Drew\.m2\repository\com\google\appengine\appengine-java-sdk\1.9.40\appengine-java-sdk\appengine-java-sdk-1.9.40\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT\WEB-INF\appengine-web.xml'
[ERROR] Aug 16, 2016 4:35:26 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
[ERROR] Aug 16, 2016 3:35:27 PM com.google.appengine.tools.development.IsolatedAppClassLoader checkWorkingDirectory
[ERROR] WARNING: Your working directory, (C:\Users\Drew\IntelliJ\UsavApp\app) is not equal to your
[ERROR] web application root (C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT)
[ERROR] You will not be able to access files from your working directory on the production server.
[ERROR]
[ERROR] Aug 16, 2016 3:35:27 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: jetty-6.1.x
[INFO] ChatServiceImpl constructed
[INFO] BlobServiceImpl constructed
[INFO] UploadPricesServlet constructed
[ERROR] Aug 16, 2016 3:35:30 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: Started SelectChannelConnector#0.0.0.0:8888
[ERROR] Aug 16, 2016 3:35:30 PM com.google.appengine.tools.development.AbstractModule startup
[ERROR] INFO: Module instance default is running at http://localhost:8888/
[ERROR] Aug 16, 2016 3:35:30 PM com.google.appengine.tools.development.AbstractModule startup
[ERROR] INFO: The admin console is running at http://localhost:8888/_ah/admin
[ERROR] Aug 16, 2016 4:35:30 PM com.google.appengine.tools.development.DevAppServerImpl doStart
[ERROR] INFO: Dev App Server is now running
But when I open localhost:8888 I get the "Couldn't load project from Super Dev Mode" error:
If I go to http://localhost:9876 I see this message:
HTTP ERROR: 500
Problem accessing /. Reason:
java.lang.NoSuchMethodError:
javax.servlet.http.HttpServletResponse.getHeader(Ljava/lang/String;)Ljava/lang/String;
EDIT: pom.xml setup requested
I have created a gist with the 5 pom.xml files here: https://gist.github.com/slugmandrew/1d9acf86be2c7db89031dc60de9df6e2
EDIT 2: Have had some success getting SDM to run, but for some reason file changes aren't being detected, so it never recompiles.
Google Groups post: https://groups.google.com/forum/#!topic/google-web-toolkit/dF8KhbxnlBY
The getHeader method of HttpServletResponse is part of the Servlet 3.0 API. Check your classpath for an older version of the Servlet API, ie conflicting GWT version jars (2.6 vs 2.7), conflicting Jetty jars, or conflicting servlet-api jars.

Cargo Maven Tomcat NoInitialContextException When i already got Context

i am using cargo maven plugin to deploy my .war to a Tomcat 8 instance for integration testing.
The application is a jersey-based REST webinterface.
My problem appears in the underlying database connection pooling.
In integration test, there is a NoInitialContextException leading to a NullPointerexception.
I build 2 pools (1 for the application and one for oacc):
public class DBCPool {
static final Logger LOGGER = LogManager.getRootLogger();
static DataSource dbs = null;
static DataSource oaccDS = null;
private DBCPool() {};
public static boolean startup() {
if (dbs != null && oaccDS != null) {
LOGGER.trace("DBCPool startup when pool != null");
return true;
} else {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Context ctxt = new InitialContext();
LOGGER.debug("Initial context is: " + ctxt.getNameInNamespace());
if (dbs == null) {
LOGGER.trace("GTM DBCPool startup");
dbs = (DataSource) ctxt.lookup("java:comp/env/jdbc/gtmdb");
LOGGER.trace("Set dbs as " + dbs.toString());
}
if (oaccDS == null) {
LOGGER.trace("OACC DBCPool startup");
oaccDS = (DataSource) ctxt.lookup("java:comp/env/jdbc/oaccdb");
}
return true;
} catch (Exception e) {
LOGGER.catching(e);
return false;
}
}
}
public static Connection getConnection() throws SQLException {
if (dbs == null) {
LOGGER.debug("Had to start DBCPool in getConnection.");
}
return dbs.getConnection();
}
There is some logging now which i added to understand the error, which will be deleted later.
The startup() is called on contextInitialized, therefore the DBCPool is set when the application is running.
As integration test, i've written:
#Test
public void getConnectionShouldReturnConnection() throws SQLException {
DBCPool.startup();
assertEquals(true, DBCPool.getConnection() != null);
}
The DBCPool.startup() is unnecessary for the test, but helps here because it brings the underlying Exception to the log in cli.
I then use cargo maven plugin to deploy this to a tomcat 8 instance and failsafe to do the integration testing.
This is the pom.xml snippet:
<profile>
<id>run-its</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>failsafe-it</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
</container>
<configuration>
<home>${project.build.directory}/catalina-base</home>
</configuration>
</configuration>
<executions>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
The tomcat is started and the application is deployed.
Then even the DBCPool is set up and i get no NullPointerException when logging the toString() of the datasource. This is the startup log, the log4j part cut out because it got too long.
[INFO] --- cargo-maven2-plugin:1.5.0:start (start-server) # gtm ---
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.5.0 for container tomcat8x
[INFO] You did not specify a container home nor any installer. CARGO will automatically download your container's binaries from [http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.0.35/tomcat-8.0.35.zip].
[INFO] [talledLocalContainer] Tomcat 8.x starting...
[INFO] [stalledLocalDeployer] Deploying [C:\Users\timki\git\gtm-code\gtm\target\gtm.war] to [C:\Users\timki\git\gtm-code\gtm\target/catalina-base/webapps]...
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:35 AM org.apache.catalina.startup.VersionLoggerListener log
[...]
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:35 AM org.apache.catalina.startup.HostConfig deployWAR
[INFO] [talledLocalContainer] INFORMATION: Deploying web application archive C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\gtm.war
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = oaccdb Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "50" for "maxActive" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = oaccdb Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "5000" for "maxWait" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = gtmLog Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "30" for "maxActive" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = gtmLog Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "5000" for "maxWait" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = gtmdb Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "50" for "maxActive" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
[WARNING] [talledLocalContainer] WARNUNG: Name = gtmdb Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "5000" for "maxWait" property, which is being ignored.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:36 AM org.apache.jasper.servlet.TldScanner scanJars
[INFO] [talledLocalContainer] INFORMATION: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,164 localhost-startStop-1 DEBUG Initializing configuration XmlConfiguration[location=C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\gtm\WEB-INF\classes\log4j2.xml]
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,171 localhost-startStop-1 DEBUG Installed script engines
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,440 localhost-startStop-1 DEBUG Oracle Nashorn Version: 1.8.0_73, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,441 localhost-startStop-1 DEBUG PluginManager 'Core' found 99 plugins
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,441 localhost-startStop-1 DEBUG PluginManager 'Level' found 0 plugins
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,445 localhost-startStop-1 DEBUG No scheduled items
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,445 localhost-startStop-1 DEBUG PluginManager 'Lookup' found 13 plugins
[INFO] [talledLocalContainer] 2016-07-17 10:07:37,447 localhost-startStop-1 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
[...]
[INFO] [talledLocalContainer] 10:07:37.558 [localhost-startStop-1] INFO - GTM servlet context initialized
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] DEBUG - Initial context is: java:
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - GTM DBCPool startup
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - Set dbs as org.apache.tomcat.dbcp.dbcp2.BasicDataSource#79270e48
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - OACC DBCPool startup
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:37 AM com.sun.jersey.api.core.PackagesResourceConfig init
[INFO] [talledLocalContainer] INFORMATION: Scanning for root resource and provider classes in the packages:
[INFO] [talledLocalContainer] de.osg.gtm.web
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:37 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
[INFO] [talledLocalContainer] INFORMATION: Root resource classes found:
[INFO] [talledLocalContainer] class de.osg.gtm.web.FrontendService
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:37 AM com.sun.jersey.api.core.ScanningResourceConfig init
[INFO] [talledLocalContainer] INFORMATION: No provider classes found.
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:37 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
[INFO] [talledLocalContainer] INFORMATION: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 03:25 AM'
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.HostConfig deployWAR
[INFO] [talledLocalContainer] INFORMATION: Deployment of web application archive C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\gtm.war has finished in 2,448 ms
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFORMATION: Deploying web application directory C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\host-manager
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFORMATION: Deployment of web application directory C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\host-manager has finished in 31 ms
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFORMATION: Deploying web application directory C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\manager
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFORMATION: Deployment of web application directory C:\Users\timki\git\gtm-code\gtm\target\catalina-base\webapps\manager has finished in 24 ms
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.coyote.AbstractProtocol start
[INFO] [talledLocalContainer] INFORMATION: Starting ProtocolHandler ["http-nio-8080"]
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.coyote.AbstractProtocol start
[INFO] [talledLocalContainer] INFORMATION: Starting ProtocolHandler ["ajp-nio-8009"]
[INFO] [talledLocalContainer] Jul 17, 2016 10:07:38 AM org.apache.catalina.startup.Catalina start
[INFO] [talledLocalContainer] INFORMATION: Server startup in 2821 ms
[INFO] [talledLocalContainer] Tomcat 8.x started on port [8080]
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (failsafe-it) # gtm ---
[INFO] Failsafe report directory: C:\Users\timki\git\gtm-code\gtm\target\failsafe-reports
-------------------------------------------------------
T E S T S
As you can see from
[INFO] [talledLocalContainer] 10:07:37.558 [localhost-startStop-1] INFO - GTM servlet context initialized
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] DEBUG - Initial context is: java:
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - GTM DBCPool startup
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - Set dbs as org.apache.tomcat.dbcp.dbcp2.BasicDataSource#79270e48
[INFO] [talledLocalContainer] 10:07:37.565 [localhost-startStop-1] TRACE - OACC DBCPool startup
I got the initialContext and even the datasource from the lookup.
But then, in testing:
10:07:39.631 [main] ERROR - Catching
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) ~[?:1.8.0_73]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) ~[?:1.8.0_73]
at javax.naming.InitialContext.getNameInNamespace(InitialContext.java:563) ~[?:1.8.0_73]
at de.osg.gtm.management.DBCPool.startup(DBCPool.java:34) [classes/:?]
at de.osg.gtm.management.DBCPoolIT.getConnectionShouldReturnConnection(DBCPoolIT.java:13) [test-classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_73]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit-4.8.2.jar:?]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.8.2.jar:?]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit-4.8.2.jar:?]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.8.2.jar:?]
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) [junit-4.8.2.jar:?]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) [junit-4.8.2.jar:?]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit-4.8.2.jar:?]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit-4.8.2.jar:?]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367) [surefire-junit4-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274) [surefire-junit4-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161) [surefire-junit4-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) [surefire-booter-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) [surefire-booter-2.19.1.jar:2.19.1]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) [surefire-booter-2.19.1.jar:2.19.1]
10:07:39.637 [main] DEBUG - Had to start DBCPool in getConnection.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.684 sec <<< FAILURE! - in de.osg.gtm.management.DBCPoolIT
getConnectionShouldReturnConnection(de.osg.gtm.management.DBCPoolIT) Time elapsed: 0.656 sec <<< ERROR!
java.lang.NullPointerException
at de.osg.gtm.management.DBCPoolIT.getConnectionShouldReturnConnection(DBCPoolIT.java:14)
So there it is. I get the DBCPool set up, but then in testing the dbs (databasesource, the DBCPool instance) is null again and initialContext can not be retrieved.
I guess i did something wrong in configuring failsafe, so that it does not test the deployed application and therefore does not get a Context. But i do not find my error, no matter how many examples and tutorials i study.
I had the same error with maven tomcat plugin and hoped to solve it with the cargo maven plugin, but no.
Thanks in advance for any help.
RMG
Have you thought about the maven lifecycle and when the cargo-maven2-plugin starts to work? Maybe the application will be deployed after the integration tests.
If the lifecycle would be like:
Maven: clean > test > it-test > install > deploy
Your it-suite would run without the necessary tomcat container. And fail with good reasons.
Maybe you split your profile run-its into:
deploy application with cargo (exclude its)
run its (exclude deployment)
This approach would ensure the up-and-running tomcat container.

Maven, tomcat7, Simple Web App. java.lang.LinkageError: loader constraint violation

I'm following directions from book "Introducing Maven, Apress", to create a simple web app: HelloWorld!! in a JSP . With Maven and Tomcat7 and using following artifact: (by the way I'm using win7)
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
The structure created is as follow:
gswm-web
|_pom.xml
|_src
|_main
|_resources
|_webapp
|_WEB-INF
| |_web.xml
|_index.jsp
And pom.xml looks as below, with a tomcat plug-in added:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.apress.gswmbook</groupId>
<artifactId>gswm-web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>gswm-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>gswm-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
</project>
then I run from command line in root of project following command:
mvn tomcat7:run
And I'm getting following information:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------------------------------------------------
----
[INFO] Building gswm-web Maven Webapp 1.0-SNAPSHOT
[INFO] ---------------------------------------------------------------------
---
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) # gswm-web >>>
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-
api/2.1/jsp-api-2.1.pom
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-
api/2.1/jsp-api-2.1.pom
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-
api/2.1/jsp-api-2.1.jar
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-
api/2.1/jsp-api-2.1.jar
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # gswm-
web ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources, i.e. build is
platform dependent!
[INFO] skip non existing resourceDirectory
C:\MauricioFiles\Maven\gswm-book-master\gswm-book-
master\chapter6\final\gswm-web\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # gswm-web
---
[INFO] No sources to compile
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) # gswm-web <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # gswm-web ---
[INFO] Running war on http://localhost:8080/gswm-web
[INFO] Creating Tomcat server configuration at
C:\MauricioFiles\Maven\gswm-book-master\gswm-book-
master\chapter6\final\gswm-web\target\tomcat
[INFO] create webapp with contextPath: /gswm-web
Jun 03, 2015 1:50:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 03, 2015 1:50:08 PM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Tomcat
Jun 03, 2015 1:50:08 PM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Jun 03, 2015 1:50:12 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
But when I try to display project in browser at port 8080 I'm getting below message:
Jun 03, 2015 1:50:34 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/gswm-web]
threw exception
[java.lang.LinkageError: loader constraint violation: loader (instance of
org/apache/jasper/servlet/JasperLoader)
previously initiated loading for a different type with name
"javax/servlet/http/HttpServletRequest"]
with root cause
java.lang.LinkageError: loader constraint violation: loader
(instance of org/apache/jasper/servlet/JasperLoader) previously initiated
loading for a different type with name
"javax/servlet/http/HttpServletRequest"
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
at
org.apache.catalina.util.Introspection.getDeclaredMethods
(Introspection.java:127)
at
org.apache.catalina.core.DefaultInstanceManager.populateAnnotationsCache
(DefaultInstanceManager.java:342)
at org.apache.catalina.core.DefaultInstanceManager.newInstance
(DefaultInstanceManager.java:161)
at org.apache.catalina.core.DefaultInstanceManager.newInstance
(DefaultInstanceManager.java:149)
at org.apache.jasper.servlet.JspServletWrapper.getServlet
(JspServletWrapper.java:172)
at org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:210)
at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process
(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run
(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Among other things I have tried, doing some research I have added following lines to pom, without success:
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
Does anybody know how could this be fixed?. Thank you alot
Do the same for the javax.servlet-api artifact:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>xxxx</version><!-- Whatever version you are using -->
<scope>provided</scope>
</dependency>
Actually the offending class, HttpServletRequest is in this artifact.
The servlet-api dependency in the pom.xml needed the "provided" scope. This is because Tomcat already provides (requires and uses itself) the servlet-api dependency. Maven's dependency scoping rules are defined here
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>xxxx</version><!-- Whatever version you are using -->
<scope>provided</scope>
</dependency>

Resources