Commons Chain Deployment - java

I have developed an Application in Java using
<dependency>
<groupId>commons-chain</groupId>
<artifactId>commons-chain</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
The deployed jar produces:
Sep 09, 2015 4:26:17 PM org.apache.commons.digester.Digester startElement
SEVERE: Begin event threw exception
java.lang.ClassNotFoundException: lib.cF.gF.CE
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:210)
at org.apache.commons.digester.Rule.begin(Rule.java:177)
at org.apache.commons.digester.Digester.startElement(Digester.java:1583)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at org.apache.commons.digester.Digester.parse(Digester.java:1990)
at org.apache.commons.chain.config.ConfigParser.parse(ConfigParser.java:190)
at lib.Utilities.CatalogLoader.getCatalog(CatalogLoader.java:25)
at main.PFChain.executePFChain(PFChain.java:27)
at main.Main.main(Main.java:30)
I allready read in WebSphere ClassNotFoundException with deployed dynamic web project that i might have to copy the *digister.jar to my unix system as well.
But i dont know Where, since this is not a web application.
EDIT:
as suggested by #Amila i ran
user#system:/folder$ java -cp "*.jar" main.Main Error: Could not find or load main class main.Main
How do i get my jar to run on the server as well?

You need to include the library jars you've used in classpath.
Something like:
java -cp 'program.jar:library1.jar:library2.jar' yourpackage.YourClass
Since you're using maven, you can copy all dependencies using maven dependency plugin, and store all of them in a lib directory.
Then you can do (Java 6+):
java -cp 'program.jar:lib/*' yourpackage.YourClass

I found the sad solution to my problem.
I refactored files a few Days ago, an maven did not get the refactoring
a maven:clean solved the Problem
Thanks to #Amila for the help.

Related

ClassNotFoundException oracle.i18n.util.LocaleMapper on tomcat TLD scanning. ojdbc7 maven dep (xmlparserv2-12.1.0.2.jar transitive) causes this error

I am receiving an error when running my spring-boot application with embedded-tomcat (haven't tried with server tomcat yet).
java.lang.IllegalStateException: Tomcat 7 reflection failed
at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner.scan(SkipPatternJarScanner.java:77)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:271)
at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:590)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5522)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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:748)
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.context.embedded.tomcat.SkipPatternJarScanner.scan(SkipPatternJarScanner.java:73)
... 12 common frames omitted
Caused by: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper
at oracle.xml.parser.v2.XMLReader.setEncoding(XMLReader.java:980)
at oracle.xml.parser.v2.XMLReader.checkXMLDecl(XMLReader.java:3284)
at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:570)
at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:274)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:232)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
at org.apache.catalina.startup.TldConfig.tldScanStream(TldConfig.java:565)
at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:513)
at org.apache.catalina.startup.TldConfig.access$200(TldConfig.java:61)
at org.apache.catalina.startup.TldConfig$TldJarScannerCallback.scan(TldConfig.java:300)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:259)
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:221)
... 17 common frames omitted
Caused by: java.lang.ClassNotFoundException: oracle.i18n.util.LocaleMapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 29 common frames omitted
On further inspection, It appears as though the previous version of the orai18n.jar depended on by the ojdbc7 maven dep contained this class in vesion 11.2.0.3 but the newer (12.1.0.2) file does not contain it.
After much hassle, I've found the root cause (Edit: Actually the better answer provided has a more appropriate cause/solution, see Serri's answer):
according to this bug comment in spring-boot The Oracle SaxParserFactory impl and the (later run into after solving the first) DocumentBuilderFactory implementations are picked up instead of the default xerces impls. Changing the implementation using the META-INF/services/<class-name> files solved the issue:
in my.jar:
and each file:
// javax.xml.parsers.DocumentBuilderFactory
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
// javax.xml.parsers.SAXParserFactory
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
This causes each service finder to resolve the default xerces implementation in the standard java library.
It's a conflict with xmlparserv2.
Try this :
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<exclusions>
<exclusion>
<groupId>com.oracle.jdbc</groupId>
<artifactId>xmlparserv2</artifactId>
</exclusion>
</exclusions>
</dependency>
In my case I had the Oracle Jars installed under $CATALINA_HOME/lib to be able to set up a JNDI DB connection in Tomcat, simply removing xmlparserv2.jar from the $CATALINA_HOME/lib directory resolved the problem.
New change for xdb instead com.oracle.jdbc use: com.oracle.ojdbc.
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>xdb</artifactId>
<version>19.3.0.0</version>
<exclusions>
<exclusion>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>xmlparserv2</artifactId>
</exclusion>
</exclusions>
</dependency>
The cause of the problem is as Serri said, except for the solution given by Serri I think if you use IntelliJ IDEA as a coding tool, please check Project Structure Artifacts to remove the dependency on xmlparserv2, this worked for me
Remove conflicting dependencies

TomEE throws An invalid Lifecycle transition

I'm doing a major refactor of a web application using the maven multi-module approach.
At the get-go there was only 1 module.
I've slowly been breaking out functionality and creating a dependency chain that the main module would depend on.
Other pertinent information worth mentioning:
We are using the following:
TomEE (Apache TomEE-JAXRS 1.5.1)
OpenEJB
Apache Maven
JDK 1.7.x
Currently my web-app is structured like this:
parent
pom.xml
|
common
pom.xml
|
persistence
pom.xml
|
export
pom.xml
|
main
pom.xml
So...
The common module's pom has NO other module dependencies.
The persistence module's pom has the following dependencies:
common
The export module's pom has the following dependencies:
common
persistence
The main module's pom has the following dependencies:
common
persistence
export
The parent module's pom specifies the REACTOR Build Order as follows:
common
persistence
export
main
Prior to the creation of the export module everything would build and deploy fine; however, now that I've broken out additional stuff from main and put it into the export module, the build is fine, but when I deploy the generated WAR file, the following stack-trace shows up upon start-up:
SEVERE: ContainerBase.removeChild: destroy:
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]] in state [STARTING_PREP]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:409)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:299)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1167)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1148)
at org.apache.tomee.catalina.TomcatWebAppBuilder.undeployWebApps(TomcatWebAppBuilder.java:635)
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:1275)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:955)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:537)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:982)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:901)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:118)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Oct 05, 2016 12:51:23 PM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal
SEVERE: Unable to deploy collapsed ear in war
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp] org.apache.openejb.OpenEJBException: Creating application failed:
C:\java\servers\apache-tomee-jaxrs-1.5.1\webapps\act-cde: Error building bean 'TaskDataAccessServices'. Exception: class java.lang.NoClassDefFoundError:
Could not initialize class com.myapp.cde.persistence.ejb.TaskDataAccessServices: Could not initialize class com.myapp.cde.persistence.ejb.TaskDataAccessServices
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:959)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:537)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:982)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:901)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:118)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.openejb.OpenEJBException: Error building bean 'TaskDataAccessServices'. Exception: class java.lang.NoClassDefFoundError:
Could not initialize class
com.myapp.cde.persistence.ejb.TaskDataAccessServices: Could not
initialize class
com.myapp.cde.persistence.ejb.TaskDataAccessServices
at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:81)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:713)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.myapp.cde.persistence.ejb.TaskDataAccessServices
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.load(EnterpriseBeanBuilder.java:425)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.loadClass(EnterpriseBeanBuilder.java:405)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(EnterpriseBeanBuilder.java:81)
at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:66)
... 19 more
Notice the TaskDataAccessServices mentioned in the stack-trace. This class is located in the persistence module. What's weird is that it's NOT used at all in the export module, which I've just created.
Question of the day: What's the best approach at debugging this issue?
I've thought about backing out changes one by one and putting classes back into the main module --- but this could take awhile ...
Wondering if there was a silver bullet approach to resolving this?
Cheers.
I'd open up your artifact and see if com.myapp.cde.persistence.ejb.TaskDataAccessServices is actually present in it.
That's what this stack trace is telling you:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.myapp.cde.persistence.ejb.TaskDataAccessServices
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.load(EnterpriseBeanBuilder.java:425)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.loadClass(EnterpriseBeanBuilder.java:405)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(EnterpriseBeanBuilder.java:81)
at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:66)
... 19 more
In the main pom.xml file, I had the following <dependency>:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.8.3</version>
</dependency>
In the export pom.xml file, I had the following <dependency>:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
Little did I know that the ehcache had it's own dependency of slf4j.
Changing the ehcache <dependency> to the following fixed things up for me:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.8.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Figuring this out required me to back things out one at a time until things stopped breaking.
Lesson learned here: commit small, commit often.

Spring Boot JSP

Is there any simple way to generate Spring Boot Mvc project for .jsp views?
I've tried to create project in similar way like Spring Boot Rest project, but it's not soo easy for me. I've tried to use official Spring Boot Mvc jsp sample, but when I try to run this I get exception like this:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [sample.jsp.SampleWebJspApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:187) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765) [spring-boot-1.4.0.BUILD-20160427.203128-289.jar:1.4.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.4.0.BUILD-20160427.203128-289.jar:1.4.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.4.0.BUILD-20160427.203128-289.jar:1.4.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1182) [spring-boot-1.4.0.BUILD-20160427.203128-289.jar:1.4.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1171) [spring-boot-1.4.0.BUILD-20160427.203128-289.jar:1.4.0.BUILD-SNAPSHOT]
at sample.jsp.SampleWebJspApplication.main(SampleWebJspApplication.java:33) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na]
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) ~[spring-core-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:300) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:237) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:204) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) ~[spring-context-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_65]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_65]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_65]
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152) ~[spring-core-4.3.0.BUILD-20160427.201731-353.jar:4.3.0.BUILD-SNAPSHOT]
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_65]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_65]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_65]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_65]
... 25 common frames omitted
This blog post explains what steps you should take and why. Its fairly easy and I've fixed it myself.
TD:LR
Add Maven Dependencies
In order to enable JSP support, we need to add a few dependencies to our new project in pom.xml.
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
Place the JSP templates under src/main/resources/META-INF/resources/WEB-INF/jsp/
As I know, the spring boot default page technology is thymeleaf and the official recommends us to use it.
If you want to use jsp, you could do some configuration.
The following steps may be useful.
1. Creating src/main/webapp/WEB-INF/jsp folder.
2. Modify application.properties file.
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
3.Add jar support for jsp. You could add the followings maven repository to your project pom.xml file.
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
Hope it helps. Any concerns, please feel free to let me know.
Add below dependencies to your POM file:
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
Create below structure
/src/main/resources/META-INF/resources
Now the above folder is equivalent to your WebContent folder. Inside this you can put your static contents. Add WEB-INF folder here and now you can place your JSP files like any other web project.
In your application.properties file add below:
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
Any chance you're running in IntelliJ? I've noticed this issue as well and the solution is to remove the <scope>provided</scope> from the spring-boot-starter-tomcat dependency, like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
There's a bug in IntelliJ, causing it not to add provided dependencies to the classpath when running locally.
EDIT: Removing the provided scope might cause issues when you're going to run it within a servlet container, so be cautious about that, an explanation about how to fix that could be found in Run Spring-boot's main using IDE.
I have had similar problems, see the link to github.
jsf-spring-boot-2.1.6 parent use spring boot 1.4.0
everything has worked and there is no problems, believe it or not!
https://github.com/joinfaces/joinfaces-example-war
Adding dependency in POM file below
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
Full code avaliable on github link click here
Download the code and import the eclipse/STS using exiting maven project
Next to run the project.
Go to the package on com.chandrakumar.test.demo.
it has "DemoApplication.java" and right click the mouse and select run as
choose the java application.
The browser address bar type "http://localhost:8080/".
Following johnny's reply, I actually wasn't aware that JSP files could be ran while deploying the application as a JAR. Though apparently there are some extensions that I haven't heard of... Typically, a JSP application is deployed as a WAR, and all JSP-related files are located in the webapp/WEB-INF/ folder. You may need to add <packaging>war</packaging> to your POM if if you are comfortable packaging your application as a WAR. This doesn't sound like a bad idea if your application is not a microservice or does not utilize cloud-based technologies. But the majority of cloud-based technologies (excluding cloud-foundry and maybe some others) only support JAR packaging. In that case, you may want to use alternative templates such as Thymeleaf or FreeMarker, over JSP, if you decide to go the JAR route.
Use a maven run configuration with spring-boot:run as the "Command line" value.

java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener Error on Deployment in NetBeans 7.0.1

I have a web application in struts2 framework in NetBeans 7.0.1. it was working fine. But suddenly the Tomcat has started to give the following error:
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Any help?
Had the same problem. You probably used NetBeans to auto add this dependency with default 'compile' scope and it broke tomcat:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency>
Use provided scope like here https://stackoverflow.com/a/10156854/1051834
If it does not help install a fresh tomcat and redeploy your project once again.
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.6</version>
is worked for me, you can change version as it release new versions.
The jsf-implementation library is missing in your application (it should be in WEB-INF\lib\ directory of application).
If you are starting application from Netbeans, this library (jsf-impl.jar?) is configured in classpath of Netbeans project, so there was no error.

Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JDBC_DBO]]

I get this Tomcat Error:
Sep 09, 2012 4:16:54 PM org.apache.catalina.core.AprLifecycleListener init
Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Products\jdk1.7.0_03\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Products/jdk1.7.0_03/jre/bin/client;C:/Products/jdk1.7.0_03/jre/bin;C:/Products/jdk1.7.0_03/jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Products\jdk1.7.0_03\jre\bin;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:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Products\eclipse32;;.
Sep 09, 2012 4:16:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:NAR_JDBC_DBO' did not find a matching property.
Sep 09, 2012 4:16:55 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["http-bio-80"]
Sep 09, 2012 4:16:55 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 09, 2012 4:16:55 PM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 1008 ms
Sep 09, 2012 4:16:55 PM org.apache.catalina.core.StandardService startInternal
Information: Starting service Catalina
Sep 09, 2012 4:16:55 PM org.apache.catalina.core.StandardEngine startInternal
Information: Starting Servlet Engine: Apache Tomcat/7.0.27
Sep 09, 2012 4:16:55 PM org.apache.catalina.core.ContainerBase startInternal
Schwerwiegend: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/NAR_JDBC_DBO]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/NAR_JDBC_DBO]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
at java.lang.Class.getDeclaredFields(Class.java:1760)
at org.apache.catalina.startup.WebAnnotationSet.getDeclaredFields(WebAnnotationSet.java:452)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:257)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:136)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:66)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.RuleSet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 21 more
Sep 09, 2012 4:16:55 PM org.apache.catalina.core.ContainerBase startInternal
Schwerwiegend: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:675)
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:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1136)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Sep 09, 2012 4:16:55 PM org.apache.catalina.startup.Catalina start
Schwerwiegend: Catalina.start:
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:675)
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:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1136)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Sep 09, 2012 4:16:55 PM org.apache.catalina.startup.Catalina start
Information: Server startup in 540 ms
What's the problem? I am using an Apache Tomcat 7 and the following 4 catalina jars are used:
catalina.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
Are any other JAR files missing?
You are missing commons-digester3-3.2.jar from Apache Commons Digester. If you are using Maven you can add:
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
to your project dependencies.
Update:
The jar from the latest download page has a slightly different package structure to what your application expects. You can use this older jar instead.
I had the same problem in my tomcat server but when i check deeply i found that i add a new tag in my web.xml file and the server doesn't accept it so check your file to if any update happened then restart your tomcat and will be good .
If u r using eclipse then delete tomcat server and Server folder then reconfigure
those two..
web module -> Properties -> Deployment Assembly -> (add folder "src/main/webapp", Maven Dependencies and other needed module)
I was getting this while running in Java EE Eclipse. None of the answers here helped. What finally did it for me was:
maven clean
start tomcat in debug
I kept doing a maven clean install and error wouldn't go away. Weird.
If you are using dynamic web project then make sure you have added the jar file as commons-logging-1.2.jar in "WebContent > WEB-INF > lib" folder.
Along with you can do few more step as:
Right click on project > Properties > Targeted Runtimes > Choose Apache Tomcat server from list > Apply > Ok.
Go to Servers tab > Right click on server configured > Properties > General > Switch location(eg- /Servers/Tomcat/.....) > Apply > Ok.
That's all!
I guess you are working with a Dynamic Web Project, because you mentioned de folder WEB-INF/lib in a comment; if yes, make sure your not putting any *-servlet jar file inside this folder or other jar already provided by the container, in this case Tomcat.
Plus: Once I used jersey-servlet.jar, and I needed to remove it from the lib folder in order to Tomcat start without problems; then I use just jersey-bundle.jar and it works well.
Well I am not sure what actual cause is but I have done this way for the same error. I have comment out this annotation for the servelet and its working.
//#WebServlet("/HelloWorld")
public class HelloWorld extends HttpServlet {
Dont know that could be proper solution of not. but this worked and another thing that can be test is add servlet jar into class path. That might work.
For me, I did mvn clean and then restart the tomcat. It worked for me
I had the same problem, even after trying "mvn eclipse:eclipse -Dwtpversion=2.0" and "mvn clean install". But after I clean my server it just worked. So maybe after you are sure you have all the dependency needed try to clean the server.
Check your application is building successfully by running mvn clean install over your project and correct all the errors
Usually this error comes when you have dependencies which are not present on your classpath.
If you are using tomcat maven plugin then try deploying your war using following command
tomcat7:run-war-only
Even I had same problem
Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]
I have added respective dependency at very begenining it had worked for me.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
I had the same issue. After much searching I decided to reconfigure my server in Eclipse. (ie clean it as suggested by Benson
Go to Project Explorer, Servers and Delete (ensure you also delete contents on disk)
Then go to Windows->Preferences->Server->Runtime Environments
Remove the Tomcat server and then add it back in.
This cleans up the server.xml, webxml, context.xml files. It basically rewrites them. Something in one of mine (or multiple things) were awry and this fixes it. A bit simpler than trying to find the offending tags/lines
Windows -> Preferences -> Server -> Runtime Environment -> Delete all Apache servers available. Add the same. Now run your application on server. Its done
:)
I met this error and tried several ways you guys mentioned still didn't work. I even tried to reinstall Tomcat, still have this error.
The last thing I did was to remove the entire Netbeans and Tomcat. It finally worked out. I know this isn't a good way to solve problem, but if you are really hurry and don't know what to do.
all i found solution for whatever you all get the exception like..
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]..
the problem with bulid path of the jars..
To over come this problem.. place all jars in "WebContent/lib" whatever you need to in your project.
i hope it will useful to you...
It is because one or all of the maven dependencies got corrupted. Just delete corrupted dependencies or all the maven local dependencies and restart the eclipse and update project.
try to add this maven dependency in your pom.xml:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2</version>
</dependency>
I had the same problem.
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
Already all robotet. My pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.springapp
war
1.0-SNAPSHOT
war
rent</name>-->
<properties>
<spring.version>4.1.1.RELEASE</spring.version>
<spring.security.version>3.2.6.RELEASE</spring.security.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!--Spring Security-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!--JUnit-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<build>
<finalName>war</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
I configure a servlet in web.ml , again i configured same servlet using annotations in servlet class. I removed annotation based configuration then server started properly.
server.xml is created when you publish a project.Now If you add more dependency later then server.xml will not be able to catch it until and unless it is refreshed again. Sometimes you need to rebuild context/config file also.
First you try to clean the work directory.If it doesn't work then delete server and Server folder,then reconfigure those two.
In intelliJ I had two different tomcat versions/folders specified for Tomcat Home and Tomcat base directory in app server configuration
I had the same problem which was caused by this nested exception
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
Looking closely found that it is due to the spring version which had a bad signature. Changed spring version to 4.3.4, build and deployed. Everything worked.
HTH
Posting since this solution may help somebody:
I faced a similar issue with the Tomcat 8.0. Seems the tomcat jar files might have corrupted. So I just downloaded the new Tomcat 8.0, unzipped it and configured it with my eclipse IDE. Also check the Project Facet under the preference menu.
I think the issue with the deployment descriptor and dependencies that you are using.
I was having the same issue that I resolved by doing these things.
Update your POM.XML
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
Also, add this code inside your build tag under the POM.XML only Since Container needs to know that where is your resource file configured.
<build>
<finalName>HatchWaysAppAPI</finalName>
<sourceDirectory>src/main/resources</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Change your resource folder according to your requirement.
Your Web.xml should be like this.
<servlet>
<servlet-name>HatchWaysAppAPI Maven Webapp</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.hatchwaysapi.mainController</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HatchWaysAppAPI Maven Webapp</servlet-name>
<url-pattern>/v1/*</url-pattern>
</servlet-mapping>
Note This configuration only for the maven if you not using maven than ignore Pom.XML just do config of the Web.xml.
I have changed all jars of spring version in lib folder of WEB INF, it works for me if u are using maven project just update dependency with different version it might work
After spending lot of time on internet. I found that NONE of the option
worked for I tried
Right click on the server -> Clean. didn't work.
What worked is:
You just to add<absolute-ordering/> tag to your web.xml just under the <display-name> tag and it should work.for more detail click here
Just clean your server (in my case I was using Tomcat):
mvn clean
mvn install
The filter name I mentioned in my web.xml doesn't exist. After correcting the typo it worked perfectly.
To resolve this issue, you have to delete the .snap file located in the directory:
<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources.
After deleting this file, you could start Eclipse with no problem.

Categories