Home  >  Q&A  >  body text

java - No resource at druid-stat-interceptor请问有遇到过这个问题吗如何解决

问题:

我的项目每次启动都报这个异常,但是并不影响使用,看着很心烦,百度,谷歌无果,前来提问

异常信息

Lcom/alibaba/druid/support/spring/stat/DruidStatInterceptor;
2016-08-24 09:41:39.541:WARN::EXCEPTION 
java.lang.IllegalStateException: No resource at druid-stat-interceptor
    at org.eclipse.jetty.annotations.ResourceAnnotationHandler.handleField(ResourceAnnotationHandler.java:166)
    at org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor$3$1.visitEnd(AnnotationParser.java:375)
    at org.objectweb.asm.ClassReader.a(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:595)
    at org.eclipse.jetty.annotations.AnnotationParser.access$000(AnnotationParser.java:43)
    at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
    at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
    at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
    at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
    at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
    at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:69)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:991)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:588)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:380)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:114)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:162)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
    at org.eclipse.jetty.server.Server.doStart(Server.java:242)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:67)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:437)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:377)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:577)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

使用的数据源

 <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="url" value="${datasource.mysql.databaseUrl}"/>
        <property name="driverClassName" value="${datasource.mysql.databaseDriver}"/>
        <property name="username" value="${datasource.mysql.username}"/>
        <property name="password" value="${datasource.mysql.password}"/>

        <property name="filters" value="stat"/>
        <property name="maxActive" value="20"/>
        <property name="initialSize" value="1"/>
        <property name="maxWait" value="60000"/>
        <property name="minIdle" value="1"/>

        <property name="timeBetweenEvictionRunsMillis" value="60000"/>
        <property name="minEvictableIdleTimeMillis" value="300000"/>

        <property name="validationQuery" value="SELECT 'x'"/>
        <property name="testWhileIdle" value="true"/>
        <property name="testOnBorrow" value="false"/>
        <property name="testOnReturn" value="false"/>

        <property name="poolPreparedStatements" value="true"/>
        <property name="maxPoolPreparedStatementPerConnectionSize" value="50"/>
    </bean>

在github上问了无果,想到这个数据源是阿里巴巴的估计在国内提问比较靠谱。
各位大神帮忙!

PHP中文网PHP中文网2762 days ago343

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-18 09:52:54

    Try adding metadata-complete="true" to the webapp configuration

    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        metadata-complete="true" version="2.5">

    Refer to this article

    reply
    0
  • Cancelreply