web-dev-qa-db-ja.com

java.lang.NoSuchMethodError:org.slf4j.spi.LocationAwareLogger.log(Lorg / slf4j / Marker; Ljava / lang / String; ILjava / lang / String; [Ljava / lang / Obje

私はMaven、Spring、埋め込まれたGlassfish、依存関係の競合の初心者です(それらの表示方法と解決方法がわかりません)...そして何時間も費やしてもこの問題を一人で解決することはできませんしようとしています。

埋め込みTomcat7ではこの問題は発生しませんが、埋め込みglassfishでは発生します

Eclipseから「実行構成」を実行します

  • 組み込みのMavenランタイム3.0.4/1.4.0、
  • 目標:埋め込みパッケージglass-fish:runのクリーンパッケージ
  • jre:jdk-7u51

問題の解決にご協力いただきありがとうございます。

 Grave: WebModule[/myapp]StandardWrapper.Throwable
Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.Apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.Java:159)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:453)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.Java:244)
    at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1444)
    at org.Apache.catalina.core.StandardWrapper.load(StandardWrapper.Java:1241)
    at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5093)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5380)
    at com.Sun.enterprise.web.WebModule.start(WebModule.Java:498)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:917)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:901)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:733)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:2000)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:1651)
    at com.Sun.enterprise.web.WebApplication.start(WebApplication.Java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.Java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.Java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.Java:294)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:462)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.Java:382)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.Java:355)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:370)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1064)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.Java:96)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1244)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1232)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:129)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:105)
    at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.Java:106)
    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.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.Java:239)
    at org.glassfish.maven.RunMojo.execute(RunMojo.Java:68)
    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)

janv. 26, 2014 12:03:54 PM com.Sun.enterprise.web.VirtualServer$1 log
Grave: WebModule[/myapp]PWC1396: Servlet /myapp threw load() exception
Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.Apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.Java:159)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:453)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.Java:244)
    at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1444)
    at org.Apache.catalina.core.StandardWrapper.load(StandardWrapper.Java:1241)
    at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5093)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5380)
    at com.Sun.enterprise.web.WebModule.start(WebModule.Java:498)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:917)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:901)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:733)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:2000)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:1651)
    at com.Sun.enterprise.web.WebApplication.start(WebApplication.Java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.Java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.Java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.Java:294)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:462)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.Java:382)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.Java:355)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:370)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1064)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.Java:96)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1244)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1232)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:129)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:105)
    at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.Java:106)
    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.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.Java:239)
    at org.glassfish.maven.RunMojo.execute(RunMojo.Java:68)
    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)

janv. 26, 2014 12:03:54 PM org.Apache.catalina.core.StandardContext start
Grave: PWC1306: Startup of context /myapp failed due to previous errors
janv. 26, 2014 12:03:54 PM com.Sun.enterprise.web.VirtualServer$1 log
Infos: PWC1412: WebModule[null] ServletContext.log():Destroying Spring FrameworkServlet 'mvc-dispatcher'
janv. 26, 2014 12:03:54 PM org.Apache.catalina.core.ContainerBase addChildInternal
Grave: ContainerBase.addChild: start: 
org.Apache.catalina.LifecycleException: org.Apache.catalina.LifecycleException: Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5389)
    at com.Sun.enterprise.web.WebModule.start(WebModule.Java:498)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:917)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:901)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:733)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:2000)
    at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:1651)
    at com.Sun.enterprise.web.WebApplication.start(WebApplication.Java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.Java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.Java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.Java:294)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:462)
    at com.Sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.Java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.Java:382)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.Java:355)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:370)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1064)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.Java:96)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1244)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1232)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:129)
    at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:105)
    at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.Java:106)
    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.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.Java:239)
    at org.glassfish.maven.RunMojo.execute(RunMojo.Java:68)
    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)
Caused by: org.Apache.catalina.LifecycleException: Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5103)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5380)
    ... 49 more
Caused by: Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.Apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.Java:159)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:453)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.Java:244)
    at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1444)
    at org.Apache.catalina.core.StandardWrapper.load(StandardWrapper.Java:1241)
    at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5093)
    ... 50 more

janv. 26, 2014 12:03:54 PM org.glassfish.api.ActionReport failure
Grave: Exception while loading the app
janv. 26, 2014 12:03:55 PM org.glassfish.deployment.admin.DeployCommand execute
Grave: Exception while loading the app : Java.lang.IllegalStateException: ContainerBase.addChild: start: org.Apache.catalina.LifecycleException: org.Apache.catalina.LifecycleException: Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
PlainTextActionReporterFAILUREDescription: deploy AdminCommandError occurred during deployment: Exception while loading the app : Java.lang.IllegalStateException: ContainerBase.addChild: start: org.Apache.catalina.LifecycleException: org.Apache.catalina.LifecycleException: Java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V. Please see server.log for more details.
    [name=myapp
janv. 26, 2014 12:03:56 PM PluginUtil doDeploy
Infos: Deployed null
Hit ENTER to redeploy, X to exit

enter image description here

enter image description here

enter image description here

m2e:1.4.0.201

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.Apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 
http://maven.Apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.marc</groupId>
<artifactId>spring-mvc-3</artifactId>
<name>spring-mvc-3</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>

<properties>
    <Java-version>1.6</Java-version>
    <org.springframework-version>3.2.0.RELEASE</org.springframework-version>
    <org.aspectj-version>1.6.10</org.aspectj-version>
    <org.slf4j-version>1.7.5</org.slf4j-version>
</properties>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
             </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <!-- AspectJ -->
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>${org.aspectj-version}</version>
    </dependency>   

    <!-- Logging -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <scope>runtime</scope>
    </dependency>

    <!-- @Inject -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- Servlet -->
    <!--
    <dependency>
        <groupId>org.Apache.Tomcat</groupId>
        <artifactId>Tomcat-servlet-api</artifactId>
        <version>7.0.30</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl-api</artifactId>
        <version>1.2</version>
        <exclusions>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>jstl-impl</artifactId>
        <version>1.2</version>
        <exclusions>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    -->
    <!-- Jackson JSON Processor -->
    <!--
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.8.1</version>
    </dependency>
    -->
    <!-- Rome Atom+RSS -->
    <!--
    <dependency>
        <groupId>net.Java.dev.rome</groupId>
        <artifactId>rome</artifactId>
        <version>1.0.0</version>
    </dependency>
    -->
    <!-- JSR 303 with Hibernate Validator -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>5.0.2.Final</version>
    </dependency>

    <!--  MYSQL driver-->
<!--        <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-Java</artifactId>
        <version>5.1.27</version>
    </dependency> -->

    <!-- JDBC -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>20030825.184428</version>
    </dependency>




    <!-- Joda Time Library -->  
    <!--
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>1.6.2</version>
    </dependency>
    -->
    <!-- Test -->
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

    <!--
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${org.springframework-version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>Spring Milestone</id>
        <url>http://maven.springframework.org/milestone</url>
    </repository>
</repositories>

<build>
<finalName>spring-mvc-3</finalName>
<plugins>       
    <!--  embedded glassfish plugin -->

  <plugin>
    <groupId>org.glassfish</groupId>
    <artifactId>maven-embedded-glassfish-plugin</artifactId>
    <version>3.1.1</version>
    <configuration>
        <glassfishDirectory>${local.glassfish.home}</glassfishDirectory>
        <user>admin</user>
        <passwordFile>${local.glassfish.passfile}</passwordFile>
        <domain>
            <name>domain1</name>
            <httpPort>8080</httpPort>
            <adminPort>4848</adminPort>
            <resources>
                <jdbcDataSource>
                    <name>jdbc/TestDB</name>
                    <type>connectionPoolDataSource</type>
                    <poolName>SomePool</poolName>
         <className>com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource</className>
                    <description>Some JDBC Connection Pool</description>
                    <allowNonComponentCallers>false</allowNonComponentCallers>
                    <validateConnections>true</validateConnections>
                    <validationMethod>metaData</validationMethod>
                    <properties>
                        <property>
                            <name>portNumber</name>
                            <value>3306</value>
                        </property>
                        <property>
                            <name>password</name>
                            <value>xxxxxx</value>
                        </property>
                        <property>
                            <name>user</name>
                            <value>xxx</value>
                        </property>
                        <property>
                            <name>serverName</name>
                            <value>localhost</value>
                        </property>
                        <property>
                            <name>databaseName</name>
                            <value>xxxx</value>
                        </property>
                    </properties>
                </jdbcDataSource>
            </resources>
        </domain>
        <components>
            <component>
                <name>${project.artifactId}</name>
                <artifact>target/${project.build.finalName}.war</artifact>
            </component>
        </components>
        <debug>true</debug>
        <terse>false</terse>
        <echo>true</echo>
    </configuration>         

<!--         <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-Java</artifactId> driver mysql
            <version>5.1.27</version>
        </dependency>
    </dependencies> -->
  </plugin>

    <!-- Maven compiler plugin -->
    <plugin>
        <groupId>org.Apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>${Java-version}</source>
            <target>${Java-version}</target>
        </configuration>
    </plugin>
</plugins>

enter image description here

13
user3178994

古い質問ですが、とにかく答える価値があります... Eclipseで、プロジェクトからpom.xmlファイルを開きます。開いたら、下部の[依存関係階層]タブを選択します。ここでは、何がロードされ、どこから呼び出されているかがわかります。検索フィルターで、競合していると思われる依存関係の名前(または名前の一部)を入力します。たとえば、「slf4j」と入力して、slf4jに依存するすべての依存関係をログに記録できます。依存関係を右クリックすると、pomファイルで除外することを選択できます。 pom.xmlファイルを保存すると、依存関係階層が変更されます。アプリケーションを再度テストして、問題を解決したか、間違ったバージョンを除外したかなどを確認できます。

唯一の注意点は、除外した依存関係を元に戻したい場合は、下部の「pom.xml」タブに切り替えて、次のようなコードを見つけて削除する必要があることです。

<exclusions>
  <exclusion>
    <artifactId>[artifactId of what you removed]</artifactId>
    <groupId>[groupId of what you removed]</groupId>
  </exclusion>
</exclusions>

Pom.xmlファイルを保存すると、変更が行われます。

11
Jon

SLF4Jバージョンをダウングレードしてみてください。このエラーは通常、一部のライブラリに古いバージョンまたは新しいバージョンのSLF4Jが必要な場合に表示されます。

また、クラスパスに複数のSLF4J JARファイルがある場合、それらがすべて同じSLF4Jバージョンからのものであることを確認してください(現在のところ、これはあなたの問題ではないようです)。

編集:私はそれが埋め込まれたglassfishのみの問題であることを見落としていました。私はGlassfishを使用していませんが、問題はSLF4Jの異なるバージョンを混在させることにあります。 Glassfishが使用しているSLF4Jバージョンを確認し、同じものを使用してください。

2
jirka.pinkas