Pass custom class instance to JAX-WS service method - java
I've been having a lot of trouble trying to pass a custom object into a JAX-WS service method. Nothing I do seems to work.
How do I get an instance of this trivial class
public class User
{
// Private instance variables
public String firstname;
public String lastname;
public User() {}
// // Constructor for a new user doesn't have an ID parameter
public User (String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
// Get & Set Methods
/* Returns the user's last name */
public String getLastName() {
return lastname;
}
/* Sets the user's last name */
public void setLastName(String newLastName) {
lastname = newLastName;
}
/* Returns the user's first name */
public String getFirstName() {
return firstname;
}
/* Sets the user's first name */
public void setFirstName(String newfirstname) {
firstname = newfirstname;
}
}
To be passed into a web service method, like so:
#WebService(serviceName = "UserService",
endpointInterface = "IUserService",
targetNamespace = "http://bioflip.org")
public class UserService implements IUserService
{
#Override
public String getUserName(User user)
{
return user.getFirstName() + " " + user.getLastName();
}
}
Here is the service interface:
#WebService(targetNamespace = "http://bioflip.org")
public interface IUserService
{
#WebMethod
String getUserName(User user);
}
My service doesn't deploy on Tomcat EE 7. What is wrong? Also, any good tutorials on a topic (that is NOT a hello world tutorial, which seem to be everywhere and are super useless) would be highly appreciated.
The error part of the stack trace:
Sep 11, 2014 5:16:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/Dmitry/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Sep 11, 2014 5:16:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BioFlipServiceTest' did not find a matching property.
Sep 11, 2014 5:16:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 11, 2014 5:16:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 11, 2014 5:16:19 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: OpenEJB http://openejb.apache.org/
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Startup: Thu Sep 11 17:16:19 EDT 2014
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Copyright 1999-2013 (C) Apache OpenEJB Project, All Rights Reserved.
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Version: 4.7.0
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build date: 20140810
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build time: 12:40
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.home = /Users/Dmitry/apache-tomee-plus-1.7.0
Sep 11, 2014 5:16:19 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.base = /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
Sep 11, 2014 5:16:19 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl#1a9a098e
Sep 11, 2014 5:16:19 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Succeeded in installing singleton service
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory init
INFO: openejb configuration file is '/Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/conf/openejb.xml'
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.DeploymentsResolver loadFrom
WARNING: File error: <Deployments dir="apps/"> - Does not exist: /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/apps
Sep 11, 2014 5:16:19 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.system.apps=true'
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: openejb
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Using openejb.deploymentId.format '{ejbName}'
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb openejb/Deployer: EjbDeployment(deployment-id=openejb/Deployer)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb openejb/ConfigurationInfo: EjbDeployment(deployment-id=openejb/ConfigurationInfo)
Sep 11, 2014 5:16:19 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb MEJB: EjbDeployment(deployment-id=MEJB)
Sep 11, 2014 5:16:20 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "openejb" loaded.
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Tomcat Security Service)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=My DataSource)
Sep 11, 2014 5:16:20 PM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
INFO: Disabling testOnBorrow since no validation query is provided
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=My Unmanaged DataSource)
Sep 11, 2014 5:16:20 PM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
INFO: Disabling testOnBorrow since no validation query is provided
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Singleton Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Stateful Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.core.stateful.SimplePassivater init
INFO: Using directory /var/folders/l4/p46wd9cx2yd85xyq1jrm2k840000gn/T for stateful session passivation
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: openejb
Sep 11, 2014 5:16:20 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.jndiname.format={deploymentId}{interfaceType.openejbLegacyName}'
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=openejb/DeployerBusinessRemote) --> Ejb(deployment-id=openejb/Deployer)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/Deployer!org.apache.openejb.assembler.Deployer) --> Ejb(deployment-id=openejb/Deployer)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/Deployer) --> Ejb(deployment-id=openejb/Deployer)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=openejb/ConfigurationInfoBusinessRemote) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=MEJB) --> Ejb(deployment-id=MEJB)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/MEJB!javax.management.j2ee.ManagementHome) --> Ejb(deployment-id=MEJB)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.JndiBuilder bind
INFO: Jndi(name=global/openejb/MEJB) --> Ejb(deployment-id=MEJB)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Created Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler startEjbs
INFO: Started Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler deployMBean
INFO: Deployed MBean(openejb.user.mbeans:application=openejb,group=org.apache.openejb.assembler.monitoring,name=JMXDeployer)
Sep 11, 2014 5:16:20 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=openejb)
Sep 11, 2014 5:16:20 PM org.apache.openejb.server.ServiceManager initServer
INFO: Creating ServerService(id=cxf)
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.ServiceManager initServer
INFO: Creating ServerService(id=cxf-rs)
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.SimpleServiceManager start
INFO: ** Bound Services **
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.SimpleServiceManager printRow
INFO: NAME IP PORT
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.SimpleServiceManager start
INFO: -------
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.SimpleServiceManager start
INFO: Ready!
Sep 11, 2014 5:16:21 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2932 ms
Sep 11, 2014 5:16:21 PM org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
INFO: Importing a Tomcat Resource with id 'UserDatabase' of type 'org.apache.catalina.UserDatabase'.
Sep 11, 2014 5:16:21 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=UserDatabase)
Sep 11, 2014 5:16:21 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 11, 2014 5:16:21 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/7.0.55 (1.7.0)
Sep 11, 2014 5:16:21 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /
Sep 11, 2014 5:16:21 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ROOT
Sep 11, 2014 5:16:21 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ROOT" loaded.
Sep 11, 2014 5:16:21 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ROOT
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl#1a9a098e
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Sep 11, 2014 5:16:21 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Sep 11, 2014 5:16:21 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Sep 11, 2014 5:16:21 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 81 ms.
Sep 11, 2014 5:16:21 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ROOT)
Sep 11, 2014 5:16:21 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /BioFlipServiceTest
Sep 11, 2014 5:16:21 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/BioFlipServiceTest
Sep 11, 2014 5:16:21 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/BioFlipServiceTest" loaded.
Sep 11, 2014 5:16:21 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/BioFlipServiceTest
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl#1a9a098e
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Sep 11, 2014 5:16:21 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Sep 11, 2014 5:16:21 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Sep 11, 2014 5:16:21 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Sep 11, 2014 5:16:21 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 8 ms.
Sep 11, 2014 5:16:21 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/Users/Dmitry/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/BioFlipServiceTest)
Sep 11, 2014 5:16:21 PM org.apache.openejb.server.webservices.WsService afterApplicationCreated
SEVERE: Error deploying CXF webservice for servlet UserService
java.lang.NullPointerException
at org.apache.cxf.jaxb.Utils.getMethodXJTA(Utils.java:294)
at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:375)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:329)
at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:232)
at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:222)
at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:365)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:329)
at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:183)
at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97)
at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:325)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:697)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:214)
at org.apache.openejb.server.cxf.CxfEndpoint.doServiceCreate(CxfEndpoint.java:101)
at org.apache.openejb.server.cxf.pojo.PojoEndpoint.<init>(PojoEndpoint.java:89)
at org.apache.openejb.server.cxf.pojo.PojoWsContainer.createEndpoint(PojoWsContainer.java:70)
at org.apache.openejb.server.cxf.pojo.PojoWsContainer.createEndpoint(PojoWsContainer.java:45)
at org.apache.openejb.server.cxf.CxfWsContainer.start(CxfWsContainer.java:50)
at org.apache.openejb.server.cxf.CxfService.createPojoWsContainer(CxfService.java:102)
at org.apache.openejb.server.webservices.WsService.afterApplicationCreated(WsService.java:393)
at org.apache.tomee.webservices.TomeeJaxWsService.afterApplicationCreated(TomeeJaxWsService.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.openejb.observer.ObserverManager$MethodInvocation.invoke(ObserverManager.java:399)
at org.apache.openejb.observer.ObserverManager$InvocationList.invoke(ObserverManager.java:514)
at org.apache.openejb.observer.ObserverManager.doFire(ObserverManager.java:110)
at org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:99)
at org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:134)
at org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1651)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:116)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
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: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:724)
Sep 11, 2014 5:16:21 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 11, 2014 5:16:22 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 11, 2014 5:16:22 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 952 ms
Related
Changing Server Settings and Adding New Files Are Not Detected in Tomcat
I was trying to learn how to use servlet by following the tutorial in this page: https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html When I reached 2.6 STEP 5: Develop and Deploy a WebApp, I was told to restart tomcat so that it'll load the directory I just made. However, the changes I made was not loaded, the assigned port is still 8080 even though I assigned it to 9999 and the hello directory was not found. Here are the messages when I issued startup.bat: Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.2.21 using APR version 1.6.5. Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener initializeSSL INFO: OpenSSL successfully initialized (OpenSSL 1.1.1a 20 Nov 2018) Apr 26, 2019 5:32:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-apr-8080"] Apr 26, 2019 5:32:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-apr-8009"] Apr 26, 2019 5:32:04 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 494 ms Apr 26, 2019 5:32:04 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Apr 26, 2019 5:32:04 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Apr 26, 2019 5:32:04 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory G:\Tomcat 2\webapps\docs Apr 26, 2019 5:32:05 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [146] milliseconds. Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory G:\Tomcat 2\webapps\examples Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory G:\Tomcat 2\webapps\host-manager Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory G:\Tomcat 2\webapps\manager Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory G:\Tomcat 2\webapps\ROOT Apr 26, 2019 5:32:05 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-apr-8080"] Apr 26, 2019 5:32:05 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-apr-8009"] Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 1092 ms As you can see, the hello directory was not deployed. So, what is exactly happening here?
I just realized that when I issued the startup & shutdown command that there was an information in the console which looked like this: Using CLASSPATH: "G:\Learning\tomcat9\bin\bootstrap.jar;G:\Learning\tomcat9\bin\tomcat-juli.jar" It seemed that my classpath was pointing to the wrong path. I deleted CATALINA_HOME in the environment variable settings, and now it is working fine.
Tomcat7 doesn't initialize my spring configuration
I have a simple maven spring project, when I run the project on the tomcat server, I don't see tomcat load the configuration on the start up. MySpringMvcDispatcherServletInitializer.java package com.abc.xyz.config; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; public class MySpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { #Override protected Class<?>[] getRootConfigClasses() { // TODO Auto-generated method stub return null; } #Override protected Class<?>[] getServletConfigClasses() { return new Class[] { DemoAppConfig.class }; } #Override protected String[] getServletMappings() { return new String[] { "/" }; } } DemoAppConfig.java package com.abc.xyz.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; #Configuration #EnableWebMvc #ComponentScan("com.abc.xyz") public class DemoAppConfig implements WebMvcConfigurer { } DemoRestController.java package com.abc.xyz.rest; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; #RestController #RequestMapping("/test") public class DemoRestController { // add code for the "/hello" endpoint #GetMapping("/hello") public String sayHello() { return "Hello World!"; } } tomcat7 startup log Oct 24, 2018 4:15:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:spring-rest-demo' did not find a matching property. Oct 24, 2018 4:15:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SIT_Dashboard' did not find a matching property. Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat/7.0.82 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server built: Sep 29 2017 12:23:15 UTC Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server number: 7.0.82.0 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Name: Windows 7 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Version: 6.1 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Architecture: amd64 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Java Home: C:\FAST\JDK64\LINKS\JDK8\jre Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Version: 1.8.0_144-b01 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Vendor: Oracle Corporation Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_BASE: C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_HOME: C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.base=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.home=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82 Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dwtp.deploy=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\wtpwebapps Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Djava.endorsed.dirs=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\endorsed Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dfile.encoding=Cp1252 Oct 24, 2018 4:15:45 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\FAST\JDK64\LINKS\JDK8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\FAST\JDK64\1.8.0.144\bin;C:\ProgramData\Oracle\Java\javapath;C:\oracle\product\11.2.0\client_64\BIN\;C:\Program Files\Micro Focus\Reflection\;C:\Program Files (x86)\Micro Focus\Reflection\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\1E\SMSNomad\;C:\Program Files\aim\aim-install\bin\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Git\cmd;C:\FAST\nodejs\6.11.4\;C:\Program Files\TortoiseSVN\bin;C:\opt\gate\base91\..\perl\bin;C:\Users\R633368\AppData\Roaming\npm;C:\FAST\maven\3.5.0\apache-maven-3.5.0\bin;. Oct 24, 2018 4:15:45 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Oct 24, 2018 4:15:45 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 768 ms Oct 24, 2018 4:15:45 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Oct 24, 2018 4:15:45 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.82 Oct 24, 2018 4:15:46 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [472] milliseconds. Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\docs Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\docs has finished in 101 ms Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\examples Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#6d4352bf') Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\examples has finished in 499 ms Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\host-manager Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\host-manager has finished in 157 ms Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\manager Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\manager has finished in 82 ms Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\ROOT Oct 24, 2018 4:15:48 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\ROOT has finished in 77 ms Oct 24, 2018 4:15:48 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Oct 24, 2018 4:15:48 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Oct 24, 2018 4:15:48 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 2191 ms As you can see, the start up doesn't show it read my spring configuration, please help, thanks in advance tomcat web application manager Updated: I have a temp fix, (wow,it takes me 2 days to make some progress since there is no ERRORs at all in the project). Here is the trick: Right click project => properties=> Deployment Assembly=> add=> choose Java Build Path Entries=>choose Maven Dependencies=> apply=> OK You can see server log refresh and it finally loads spring configuration, and if you check tomcat home directory/wtpwebapps/{project name}/WEB-INF/lib, you can see all the maven dependencies are copied to here Up to this point, It looks like everything is fine now, but I find the other issue, every time I right click=>maven=> update project...=> it will try to remove the dependencies(jars) in tomcat home directory/wtpwebapps/{project name}/WEB-INF/lib, If your project is running at the tomcat , you will get a error because these jars are being used. But if you stop server, and update project and then run as server again, everything is back to normal, no error, no spring configuration in the server startup log, then you have to do the same trick again. I tried so many online solutions about "maven project update will remove jars in tomcat server", none of them are working. So if anyone has the the fix, please shared
Web application failed to start
My application failed to start with a strange error. What does it mean? янв 11, 2016 8:47:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:new_prog_22' did not find a matching property. янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat/7.0.65 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server built: Oct 9 2015 08:36:58 UTC янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server number: 7.0.65.0 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Name: Windows XP янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Version: 5.1 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Architecture: x86 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Java Home: C:\Program Files\Java\jdk1.8.0_66\jre янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Version: 1.8.0_66-b18 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Vendor: Oracle Corporation янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_BASE: C:\spring_new_works\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_HOME: C:\apache-tomcat-7.0.65 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.base=C:\spring_new_works\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.home=C:\apache-tomcat-7.0.65 янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dwtp.deploy=C:\spring_new_works\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Djava.endorsed.dirs=C:\apache-tomcat-7.0.65\endorsed янв 11, 2016 8:47:04 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dfile.encoding=Cp1251 янв 11, 2016 8:47:04 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_66\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_66/jre/bin/client;C:/Program Files/Java/jdk1.8.0_66/jre/bin;C:/Program Files/Java/jdk1.8.0_66/jre/lib/i386;C:\apache-maven-3.3.9\bin;C:\Program Files\Java\jdk1.8.0_66\jre\bin;C:\Program Files\Java\jdk1.8.0_66\bin;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Ruby193\bin;C:\Program Files\PC Connectivity Solution;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Git\cmd;C:\Program Files\Skype\Phone\;;C:\eclipse-jee-luna-SR2-win32\eclipse;;. янв 11, 2016 8:47:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] янв 11, 2016 8:47:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] янв 11, 2016 8:47:04 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 623 ms янв 11, 2016 8:47:04 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina янв 11, 2016 8:47:04 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.65 янв 11, 2016 8:47:06 PM org.apache.catalina.startup.TldConfig execute INFO: 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. янв 11, 2016 8:47:06 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath янв 11, 2016 8:47:06 PM org.apache.catalina.core.ApplicationContext log INFO: Set web app root system property: 'webapp.root' = [C:\spring_new_works\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\new_prog_22\] янв 11, 2016 8:47:06 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 20:47:06,375 INFO ContextLoader:285 - Root WebApplicationContext: initialization started 20:47:06,515 INFO AnnotationConfigWebApplicationContext:513 - Refreshing Root WebApplicationContext: startup date [Mon Jan 11 20:47:06 EET 2016]; root of context hierarchy 20:47:06,609 INFO AnnotationConfigWebApplicationContext:240 - No annotated classes found for specified class/package [control.SpringConfig] 20:47:06,687 INFO ContextLoader:325 - Root WebApplicationContext: initialization completed in 312 ms янв 11, 2016 8:47:06 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter CacheControl java.lang.ClassNotFoundException: filters.CacheControlFilter at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 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) янв 11, 2016 8:47:06 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter GzipFilter java.lang.ClassNotFoundException: util.gzip.GZipServletFilter at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 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) янв 11, 2016 8:47:06 PM org.apache.catalina.core.StandardContext startInternal SEVERE: One or more Filters failed to start. Full details will be found in the appropriate container log file янв 11, 2016 8:47:06 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/new_prog_22] startup failed due to previous errors янв 11, 2016 8:47:06 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext 20:47:06,703 INFO AnnotationConfigWebApplicationContext:873 - Closing Root WebApplicationContext: startup date [Mon Jan 11 20:47:06 EET 2016]; root of context hierarchy янв 11, 2016 8:47:06 PM org.apache.catalina.core.ApplicationContext log INFO: Shutting down log4j янв 11, 2016 8:47:06 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] янв 11, 2016 8:47:06 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] янв 11, 2016 8:47:06 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 1882 ms Note the WARNING message in the beggining of the logs. The application really names new_prog_22 and the same name is in pom.xml. Also the filter classes are present. How to fix it?
Tomcat starts but shows blank on browser
I have configured a tomcat application. This is my server.xml. When I start the tomcat it gives : Dec 08, 2015 1:50:40 PM org.apache.catalina.startup.SetAllPropertiesRule begin WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '50' did not find a matching property. Dec 08, 2015 1:50:40 PM org.apache.catalina.startup.SetAllPropertiesRule begin WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxSpareThreads' to '50' did not find a matching property. Dec 08, 2015 1:50:40 PM org.apache.tomcat.util.digester.Digester endElement WARNING: No rules found matching 'Server/Service/Realm'. Dec 08, 2015 1:50:40 PM org.apache.tomcat.util.digester.Digester endElement WARNING: No rules found matching 'Server/Service/Host'. Dec 08, 2015 1:50:40 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-nio-8491"] Dec 08, 2015 1:50:40 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector INFO: Using a shared selector for servlet write/read Dec 08, 2015 1:50:40 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-nio-8492"] Dec 08, 2015 1:50:40 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector INFO: Using a shared selector for servlet write/read Dec 08, 2015 1:50:40 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1482 ms Dec 08, 2015 1:50:41 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Nightfire-webapps Dec 08, 2015 1:50:41 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/8.0.24 Dec 08, 2015 1:50:41 PM org.apache.catalina.mapper.MapperListener findDefaultHost WARNING: Unknown default host [localhost] for service [StandardService[Nightfire-webapps]] Dec 08, 2015 1:50:41 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-nio-8491"] Dec 08, 2015 1:50:41 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-nio-8492"] Dec 08, 2015 1:50:41 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 173 ms But The browser shows blank page
java.lang.ClassNotFoundException in Dynamic Web app JSP
I am trying retrieve data from SQLLite DB in a Java Class. This is the part of the web app that uses the Beans and Form processing" as per the tutorial here: http://www.jsptut.com/forms.jsp I am getting a persistent error of java.lang.ClassNotFoundException: org.sqlite.JDBC I have added sqlite-jdbc-3.8.7.jar to the java classpath This is my code: public int startConnection() { Connection c = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); return CONNECTION_FAILURE; } System.out.println("Opened database successfully"); return CONNECTION_SUCCESSFUL; } This is the console output: Jan 03, 2015 2:42:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webapp01' did not find a matching property. Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat/7.0.57 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server built: Nov 3 2014 08:39:16 UTC Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server number: 7.0.57.0 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Name: Mac OS X Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Version: 10.10 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Architecture: x86_64 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Version: 1.8.0_25-b17 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Vendor: Oracle Corporation Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_BASE: /Users/hadi/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_HOME: /Users/hadi/Documents/apache-tomcat-7.0.57 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.base=/Users/hadi/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.home=/Users/hadi/Documents/apache-tomcat-7.0.57 Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dwtp.deploy=/Users/hadi/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Djava.endorsed.dirs=/Users/hadi/Documents/apache-tomcat-7.0.57/endorsed Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dfile.encoding=UTF-8 Jan 03, 2015 2:42:15 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/hadi/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. Jan 03, 2015 2:42:15 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jan 03, 2015 2:42:15 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1296 ms Jan 03, 2015 2:42:15 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jan 03, 2015 2:42:15 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.57 Jan 03, 2015 2:42:16 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Jan 03, 2015 2:42:16 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Jan 03, 2015 2:42:16 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 913 ms java.lang.ClassNotFoundException: org.sqlite.JDBC Jan 03, 2015 2:42:32 PM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-bio-8080"] Please anyone solve this problem......Thanks....
Add the sqlite-jdbc-3.8.7.jar to the tomcat class-path by moving it to $CATALINA_HOME/lib. See the Apache Tomcat 7 - Class Loader Howto for an in-depth look at how the Tomcat class loader works. It reads, in part, System — This class loader is normally initialized from the contents of the CLASSPATH environment variable. All such classes are visible to both Tomcat internal classes, and to web applications. However, the standard Tomcat startup scripts ($CATALINA_HOME/bin/catalina.sh or %CATALINA_HOME%\bin\catalina.bat) totally ignore the contents of the CLASSPATH environment variable itself, and instead build the System class loader from ...