I'm trying to remove Log4j from my project. The project is building sucessfully after removing but I'm getting this error while running the build.
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/azuga]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3062)
at java.base/java.lang.Class.getDeclaredFields(Class.java:2249)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationFilterAnnotations(WebAnnotationSet.java:109)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:68)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:336)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:776)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1352)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 24 more
I've tried removing dependencies I suspected to be using Log4j.
As a general advice, use a tool to manage your project's dependencies such as Gradle or Maven. These tools are capable of analyzing not only classpath dependencies but also runtime dependencies. That way, you can just see what the dependencies are - rather than suspecting.
I am migrating my application from webshpere to tomcate and IO getting below error while running tomcat server with web WAR file. PLease help me to solve this
INFO,DefaultListableBeanFactory,localhost-startStop-1] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#48a48ed: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,frameworkpum,commonProfileEntityManager,emCommon,centralCasServerURL,centralCasServerLoginURL,applicationServiceURL,casHttpsProxyHost,casHttpsProxyPort,casHttpsNonProxyHosts,proxyConfiguration,singleLogoutFilter,dciLogoutSuccessHandler,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,casAuthenticationFilter,casProcessingFilterEntryPoint,casAuthenticationProvider,serviceProperties,userService,dciscApp,propertiesHelper,facesHelper,accessDecisionManager,roleVoter,authenticatedVoter,accessDeniedHandler,syslogPath,auditManager,commonAuditService,auditConversionService,auditDTOToEntityConverter,auditEntityToDTOConverter,auditReportEntityToDTOConverter,auditDAO,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#1,auditpum,commonAuditEntityManager,emAudit,participantSearchDAO,intesSearchDAO,userProfileDAO,currencySearchDAO,countrySearchDAO,chargeTypeSearchDAO,commonMerchantCategoryDAO,contactSearchDAO,commonSecurityQuestionsDAO,applicationMakerCheckerManager,applicationManager,applicationService,commonDTOConverterService,userProfileManager,userProfileService,userProfileConversionFactory,menuBuilder,intesSearchManager,currencySearchManager,countrySearchManager,chargeTypeSearchManager,commonMerchantCategorySearchManager,participantSearchManager,contactSearchManager,intesSearchService,currencySearchService,countrySearchService,chargeTypeSearchService,commonMerchantCategorySearchService,participantSearchService,contactSearchService,commonSecurityQuestionsService,currencyConverter,countryConverter,intesConverter,chargeTypeConverter,commonMerchantCategoryConverter,participantConverter,participantCycleRangeConverter,contactConverter,commonSecurityQuestionsConverter,parser,securityHelper,passwordEncryptor,defaultPasswordGenerator,defaultPasswordValidator,passwordHelper,passwordManager,questionsHelper,questionsManager,racfAuthenticator,secApiWrapper,dsManagerWrapper,corporateLDAPConnectionParameters,org.springframework.context.config.internalBeanConfigurerAspect,makerCheckerIdFactoryImpl,makerBeanFactory,customNamespacePrefixMapper,annotationBasedCheckerService,serviceFactoryImpl,outstandingChangesServiceImpl,makerServiceImpl,checkerServiceProxy,makerCheckerDAOJpaImpl,makerCheckerEntityManager,makercheckerpum,emMakerChecker,makerCheckerManager,com.dcisc.common.makerchecker.XmlSerializer#0,applicationDatasource,emAer,aerEntityManager,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.core.session.SessionRegistryImpl#0,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,aerClientDescTabDAO,aerFranchiseDescTabDAO,aerClientTabDAO,aerExceptionTabDAO,aerFranchiseTabDAO,grfSummarySearchService,grfExceptionSearchService,fileTranSearchService,grfSummarySearchManager,grfExceptionSearchManager,fileTranSearchManager]; root of factory hierarchy
[ERROR,ContextLoader,localhost-startStop-1] Context initialization failed
java.lang.NoClassDefFoundError: com/ibm/wsspi/uow/UOWActionException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:230)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:903)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1795)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
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:745)
Caused by: java.lang.ClassNotFoundException: com.ibm.wsspi.uow.UOWActionException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
... 31 more
The error is throwed if you use the old spring TransactionManager configuration in Tomcat.
You have to replace org.springframework.transaction.jta.WebSphereUowTransactionManager with another one.
Please refer spring document for more information. Since Tomcat does not offer all Java EE features. You may need other TransactionManager solution
especially when your application access more than one database.
I have problem with my spring boot web app. It uses embedded jetty (it must be jetty - not tomcat) and it uses jsp views. But seems like there is no way to make embedded jetty work with jsp views. Actually at the moment when I run mu app server starts successfully but when I try to access any url of my web app - I get error:
org.apache.jasper.JasperException: java.lang.IllegalStateException: No Java compiler available
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:591) ~[apache-jsp-8.0.27.jar:2.3]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:397) ~[apache-jsp-8.0.27.jar:2.3]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) ~[apache-jsp-8.0.27.jar:2.3]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) ~[apache-jsp-8.0.27.jar:2.3]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) ~[spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108) ~[spring-security-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
......................
Caused by: java.lang.IllegalStateException: No Java compiler available
at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:231) ~[apache-jsp-8.0.27.jar:2.3]
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:577) ~[apache-jsp-8.0.27.jar:2.3]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) ~[apache-jsp-8.0.27.jar:2.3]
How can I make it work? Is there any way?
And if it is not possible with spring boot then what are alternative ways to make my app work on embedded jetty with jsp?
Here is link to my project on github. Please look at it and help me! It would be just great if you try to run it in your IDE (IntelliJ IDEA recommended) and find the reason of the problem.
UPDATE 1 (15.07.2016)
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [sample.jetty.jsp.SampleJettyJspApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.support.SpringBootServletInitializer
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:187) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
at sample.jetty.jsp.SampleJettyJspApplication.main(SampleJettyJspApplication.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.web.support.SpringBootServletInitializer
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:300) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:237) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:204) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
... 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.1.RELEASE.jar:4.3.1.RELEASE]
... 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
You are using Spring Boot 1.3.6 and in the JSP limitations section of the documentation it says:
Jetty does not currently work as an embedded container with JSPs.
There's an enhancement coming in Spring Boot 1.4 that means the JSPs will work with embedded Jetty as long as you use war packaging. If you don't want to wait for 1.4.0 to be released, the enhancement is in 1.4.0.RC1 which is available from https://repo.spring.io/libs-milestone. There's also a new sample application that may be of interest.
(embedded Tomcat 7.0.59, gradle 2.13, HikariCP 2.4.6, mysql-connector-java 6.0.2)
I want to create connection pool (mysql) in my web application.
When I execute gradle tomcatRun, I get the following message:
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:89)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:294)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:91)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:101)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at [my package].DbContextListener.initDataSource(DbContextListener.java:40)
at [my package].DbContextListener.contextInitialized(DbContextListener.java:27)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
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:745)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:76)
... 15 more
I found that tomcat may not contain dbcp-jar, so I tried to add it via gradle:
compile 'org.apache.tomcat:tomcat-jdbc:7.0.59' but nothing changed
Can anyone explain me how it should be done?
I tried to create/run a java web app and ran into the following error. I saw that other people have had similar problems, however, I tried what they said but they all not work.
A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CourseServer]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
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:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CourseServer]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/json/JSONException
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:256)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:334)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
... 20 more
and what's in my WEB-INF/lib
Help!
add below dependency into your pom.xml
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
If you are not using maven then you have to download and add this java-json.jar to your build path
NoClassDefFoundError: org/json/JSONException means it can't find the class JSONException at runtime. Either you add it as a dependency in your pom.xml, add it to your build-path or you add the JAR to your Tomcat Lib folder.
Either way, you'll have to get the JAR containing the JSONException. Which can be found here.
I tried all the means,they all not work until I reinstall tomacat....