- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用具有 Maven 支持的 Intellij 启动 tomcat。一旦我添加以下 tomcat maven 依赖项:
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>8.5.38</version>
</dependency>
启动后,它将抛出此异常:
Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:110)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:328)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:772)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 44 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185)
... 57 more
25-Feb-2019 00:51:29.242 SEVERE [RMI TCP Connection(4)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/web_war_exploded]]
我已经检查过我对 slf4j
的依赖是:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.22</version>
</dependency>
它显示它有类org.slf4j.Logger
:
如果我删除 tomcat 依赖项,一切都会再次正常工作。
更新:
我的pom文件:
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>chrisTina</groupId>
<artifactId>Insbot</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.8.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.logging.log4j</groupId>-->
<!--<artifactId>log4j-slf4j-impl</artifactId>-->
<!--<version>2.11.1</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.typesafe/config -->
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.awaitility/awaitility -->
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>3.1.6</version>
<!--<scope>test</scope>-->
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.1.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.9.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<!--<!– https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api –>-->
<!--<dependency>-->
<!--<groupId>javax.servlet</groupId>-->
<!--<artifactId>javax.servlet-api</artifactId>-->
<!--<version>4.0.1</version>-->
<!--<scope>provided</scope>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.22</version>
</dependency>
<!--<!– https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 –>-->
<!--<dependency>-->
<!--<groupId>org.slf4j</groupId>-->
<!--<artifactId>slf4j-log4j12</artifactId>-->
<!--<version>1.7.22</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
<!--<dependency>-->
<!--<groupId>org.apache.tomcat</groupId>-->
<!--<artifactId>tomcat-catalina</artifactId>-->
<!--<version>8.5.38</version>-->
<!--</dependency>-->
</dependencies>
<packaging>war</packaging>
MVN 输出:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ Insbot ---
[INFO] chrisTina:Insbot:war:1.0-SNAPSHOT
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-api:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.8.1:compile
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:3.8.1:compile
[INFO] | +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | +- com.google.code.gson:gson:jar:2.8.2:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] | \- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.4:provided
[INFO] +- com.typesafe:config:jar:1.2.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] +- org.awaitility:awaitility:jar:3.1.6:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | \- org.objenesis:objenesis:jar:2.6:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.15:compile
[INFO] | \- com.google.protobuf:protobuf-java:jar:3.6.1:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.4.1.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.1:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.9.10:compile
[INFO] +- com.google.guava:guava:jar:23.0:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] \- org.apache.tomcat:tomcat-catalina:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-servlet-api:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-jsp-api:jar:8.5.38:compile
[INFO] | \- org.apache.tomcat:tomcat-el-api:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-juli:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-annotations-api:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-api:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-jni:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-coyote:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-util:jar:8.5.38:compile
[INFO] +- org.apache.tomcat:tomcat-util-scan:jar:8.5.38:compile
[INFO] \- org.apache.tomcat:tomcat-jaspic-api:jar:8.5.38:compile
最佳答案
您需要将 .jar 文件添加到 lib 文件夹$TOMCAT/webapps/$YOUR_WEB_APP/WEB-INF/lib/
关于java.lang.NoClassDefFoundError : Lorg/slf4j/Logger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54860329/
val jobConf = new JobConf(hbaseConf) jobConf.setOutputFormat(classOf[TableOutputFormat]) jobConf.s
我为我的项目创建了一个新模块来添加一些额外的功能。在该模块中,我在模块的 Gradle 文件 implementation 'org.jsoup:jsoup:1.10.2' 中添加了 Jsoup 依赖
我已经能够使用出色的任务 appStartWar 或 tomcatStartWar 成功地在tomcat上部署我的Web应用程序 war 文件,但是当我尝试使用 appStart 或到位部署同一Web
我正在使用具有 Maven 支持的 Intellij 启动 tomcat。一旦我添加以下 tomcat maven 依赖项: org.apache.tomc
请帮忙。我正在尝试使用 Jboss 8.1.0 缓存功能做一个简单的缓存机制。这就是我实现项目结构的方式: pomn 文件: 4.0.0 org.jboss
我正在使用 Espresso 进行仪器测试,但在堆栈跟踪中出现此错误: 错误是由缺少的类引起的,如下所示: Caused by: java.lang.ClassNotFoundException: D
早些时候,我的 Android 项目运行良好。但是在更新客户端提供的 .aar 库后,我收到了这个错误。 在我们的项目中,我们没有在任何地方使用 jacoco 依赖项 java.lang.NoClas
我正在尝试使用 wildfly-8 在本地计算机上运行的 Web 应用程序中显示图形报告,但遇到了下一个错误。 java.lang.NoClassDefFoundError: Lorg/jfree/c
我遇到了应用程序崩溃和提供此堆栈跟踪的问题 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/code
我在进行插桩测试时遇到了以下运行时错误。 Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION: Unknown source file : com
这个问题在这里已经有了答案: Android Studio : Error injecting while Appengine backend generation (1 个回答) 关闭 8 年前。
httpPost 在所有 8.1 及以下版本的 android 设备中运行,但在 android 9.0 中运行时出现如下错误, Failed resolution of: Lorg/apache/h
从昨天开始我就有麻烦了。在我的实习中,我遇到了以下构建错误,但我不明白为什么: $ cordova build android [...] FAILURE: Build failed with an
有人可以告诉我如何解决这个问题吗?我试图创建一个新的 Maven 项目,但由于某种原因失败了 描述资源路径位置类型目标 org.apache.maven.plugins:maven-resources
我正在从 Tomcat 6.0.24 升级到 7.0.23。我有一个 maven 2.2.1 项目,它使用 jspc maven 插件预编译 JSP。 当我为我的应用程序部署 WAR 文件并尝试访问
我收到以下错误: Process: com.project.publiko, PID: 27061 java.lang.NoSuchFieldError: No static field INSTAN
错误: E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.azail.cart.debug, PID: 2403
每当我尝试为我的项目构建 APK 时,都会收到以下错误: Error:Error converting bytecode to dex: Cause: com.android.dex.DexExcep
我是用java创建一个strut项目但是报错。我认为此错误是由于缺少 jar 文件造成的,我不知道要下载哪个版本。 这是我的 lib 文件夹中的 jar 文件: commons-digester-2.
我想使用最新的 JUnit 版本: org.junit.jupiter junit-jupiter-engine
我是一名优秀的程序员,十分优秀!