Tomcat8(jdk8)没有启动。我使用的是moskito版本2.4.3。它已经被开发者嵌入了,不知道我错过了什么。
你能指出我吗?感谢04-May-2017 16:22:07.553 SEVERE [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionListener' defined in class path resource [monitoringContext-web.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.servlet.Filter]: Could not convert factory method argument value of type [net.anotheria.moskito.web.session.SessionCountProducer] to required type [javax.servlet.Filter]: Failed to convert value of type [net.anotheria.moskito.web.session.SessionCountProducer] to required type [javax.servlet.Filter]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [net.anotheria.moskito.web.session.SessionCountProducer] to required type [javax.servlet.Filter]: no matching editors or conversion strategy found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805)
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)
May 04, 2017 4:22:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
May 04, 2017 4:22:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/myapp] startup failed due to previous errors
使用这些依赖项:
moskito-aop-2.4.3.jar
moskito-central-connectors-common-1.1.0.jar
moskito-central-embedded-common-1.1.0.jar
moskito-core-2.4.4.jar
这是monitoringContext-web.xml。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
<bean id="uiUrlBuilderFilter" factory-bean="applicationFilters" factory-method="add">
<constructor-arg>
<bean class="net.domain.myapp.monitoring.filters.ApplicationContextUrlBuilderFilter" />
</constructor-arg>
</bean>
<bean id="methodFilter" factory-bean="applicationFilters" factory-method="add">
<constructor-arg>
<bean class="net.anotheria.moskito.web.filters.MethodFilter" />
</constructor-arg>
</bean>
<bean id="userAgentFilter" factory-bean="applicationFilters" factory-method="add">
<constructor-arg>
<bean class="net.anotheria.moskito.web.filters.UserAgentFilter" />
</constructor-arg>
</bean>
<bean id="sessionListener" factory-bean="applicationFilters" factory-method="add">
<constructor-arg>
<bean class="net.anotheria.moskito.web.session.SessionCountProducer" />
</constructor-arg>
</bean>
</beans>
答案 0 :(得分:1)
问题是您正在使用创建FILTERS的工厂。我认为这不是宣布会话计数器的方法。您应该为LISTENERS找到另一个工厂,或者在web.xml中自行声明,如此处所述
答案 1 :(得分:0)
+1来Rubio的回答
SessionCountProducer不是Filter,初始化它的正确方法是将下一个代码放到 web.xml :
<listener>
<listener-class>
net.anotheria.moskito.web.session.SessionCountProducer
</listener-class>
</listener>