如果我直接在独立的Tomcat 8上部署我的应用程序,服务器会毫无错误地启动。当我尝试在IntelliJ中启动Tomcat时,我收到了这个NoClassDefFoundError: org/slf4j/Logger,但应用程序无法启动。当我直接在外部Tomcat中部署WAR时,一切都很好。附件是两个POM文件:我已经查看了SO上提供的解决方案,但这种情况是IntelliJ独有的。NoClassDefFoundError: org/slf4j/Logger
母体聚甲醛
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.akaza.openclinica</groupId>
<artifactId>OpenClinica</artifactId>
<packaging>pom</packaging>
<version>MAINLINE-SNAPSHOT</version>
<name>OpenClinica</name>
<description>OpenClinica</description>
<modules>
<module>core</module>
<module>web</module>
<module>ws</module>
</modules>
...org.slf4j slf4j-jdk14 1.6.4 org.slf4j slf4j-api 1.7.6 org.slf4j slf4j-log4j12 1.7.6 org.slf4j jul-to-slf4j 1.7.6 org.slf4j jcl-over-slf4j 1.7.6 ch.qos.logback logback-core 1.1.2 ch.qos.logback logback-classic 1.1.2 ch.qos.logback-access 1.1.2 ...
</dependencyManagement>
<!-- These dependencies are used by _all_ child projects -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>8</source>
<target>8</target>
<compilerArgument>-Xlint:all</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${openclinica.distros.dir}</outputDirectory>
<descriptors>
<descriptor>${project.basedir}/src/assemble/openclinica-assemble.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<finalName>${assembly.name}-${project.version}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<addVersionToProjectName>true</addVersionToProjectName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>tomcat6x</containerId>
<home>${catalina.home}</home>
</container>
<configuration>
<home>${catalina.home}</home>
<type>existing</type>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-plugin</artifactId>
<version>1.9.1.0</version>
<configuration>
<propertyFile>${config.file}</propertyFile>
</configuration>
</plugin>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.6</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>buildnumber</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<shortRevisionLength>12</shortRevisionLength>
<buildNumberPropertyName>changeSet</buildNumberPropertyName>
</configuration>
</execution>
<execution>
<id>timestamp</id>
<phase>validate</phase>
<goals>
<goal>create-timestamp</goal>
</goals>
<configuration>
<timestampPropertyName>changeSetDate</timestampPropertyName>
<timestampFormat>yyyy-MM-dd HH:mm Z</timestampFormat>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/webapp/WEB-INF/schemas</schemaDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.33.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</testResource>
</testResources>
<!--
<filters>
<filter>src/main/filters/default.properties</filter>
<filter>src/main/filters/${config.id}.properties</filter>
</filters>
-->
</build>
<scm>
<connection>scm:git:${git.url}</connection>
<developerConnection>scm:git:${git.url}</developerConnection>
<tag>HEAD</tag>
</scm>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://dev.openclinica.com/artifactory/libs-release</url>
</repository>
<repository>
<snapshots/>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://dev.openclinica.com/artifactory/libs-snapshot</url>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://dev.openclinica.com/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots/>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://dev.openclinica.com/artifactory/plugins-snapshot</url>
</pluginRepository>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>openclinica-artifactory</id>
<name>dev.openclinica.com-releases</name>
<url>http://dev.openclinica.com/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>openclinica-artifactory</id>
<name>dev.openclinica.com-snapshots</name>
<url>http://dev.openclinica.com/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
儿童POM
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>OpenClinica-web</artifactId>
<packaging>war</packaging>
<name>OpenClinica Web Application</name>
<parent>
<groupId>org.akaza.openclinica</groupId>
<artifactId>OpenClinica</artifactId>
<version>MAINLINE-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>OpenClinica-core</artifactId>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon-dom</artifactId>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome-fetcher</artifactId>
<scope>compile</scope>
<exclusions>
<!-- We are using jdom 1.1 lib below -->
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<scope>compile</scope>
<exclusions>
<!-- We are using jdom 1.1 lib below -->
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.mockrunner.jdk15.jee5</groupId>
<artifactId>mockrunner</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mockrunner.jdk15.jee5</groupId>
<artifactId>mockrunner-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.pjl-comp-filter</groupId>
<artifactId>pjl-comp-filter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jmesa</groupId>
<artifactId>jmesa</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<scope>compile</scope>
</dependency>
<!-- Needed by commons-validator -->
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-math</groupId>
<artifactId>commons-math</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<scope>compile</scope>
</dependency>
<!-- Struts web framework -->
<dependency>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-oracle</artifactId>
</dependency>
<!-- XML serializer-->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-core -->
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-web</artifactId>
</dependency>
<!--<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</dependency>
<dependency>
<groupId>com.stormpath.spring</groupId>
<artifactId>stormpath-default-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor-core</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-svg-dom</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
</dependencies>
任何帮助都非常感谢。
范围是在Maven的DM中“提供”的。我想我的问题是我正在使用的maven配置文件。它删除了所有的jar,只保留war文件(以便在Heroku上部署它),所以Tomcat找不到这个jar,因此出现了类。
缺少的< code>org.slf4j.Logger接口包含在< code>slf4j-api jar中。您已经指出该jar(的1.7.6版)包含在父pom的< code > dependency management 部分中,但是您没有显示实际的依赖关系。它是否有< code>provided或其他非默认范围?
无论如何,当您尝试通过IntelliJ运行应用程序时,您的NoClassDefFind
错误表明该jar不在类路径中。
问题内容: 我们在项目中使用LogBack,我想根据一些数据库值配置logger,即如果某个DB值设置为true,则logger应该同时使用文件和数据库附加程序,如果为false,则logger必须仅使用DB附加程序, 我也想保留使用静态最终记录器,因此不会在每次调用记录器时都创建一个新实例, 那我该怎么做呢? 问候, 问题答案: 您应该按照本示例中的说明以编程方式配置Logback 。
问题内容: 我已经将一个Web应用程序部署到服务器上。我的应用程序使用和。但是,并非所有日志记录消息都已写入文件。 在我的课堂上,我有: 我的文件在本地计算机上运行良好,并且已正确部署。 我看到正在写入的应用程序生成的错误消息没有写入我的。由于输出模式的格式与我的模式不同,因此看起来的日志消息来自其他日志框架。我在中看到的日志记录如下: 我的log4j模式是这样的: 一些日志记录出现在我的文件日志
因此,我正在部署一个使用Hibernate4.3.6的web应用程序。和Tomcat 7。我正在尝试使用SLF4J作为日志抽象层来日志。但是,我有很多问题和疑问。首先,Hibernate和Tomcat都有不同的日志框架,分别是jboss-logging和juli(即使我在库中找不到juli),所以我认为我必须安装从这些框架到SLF4J的桥梁。对于Hibernate,根据这个答案,一个解决方案可以是
我试图将来自一个非常简单的flask应用程序的应用程序日志消息保存在日志文件中。当我使用嵌入式Flask服务器运行应用程序时,这项功能完美无瑕,但在gUnicorn中运行时,它根本不起作用,基本上,运行gUnicorn时,不会将任何应用程序输出重定向到日志文件(我的Flask应用程序中指定的日志文件)或标准输出。 也就是说,这是我的烧瓶应用程序: 现在,如果我以以下方式启动应用程序: 我得到预期的
我有个问题希望你能帮我解决。 有时,我的应用程序会出现一些错误,并继续在服务器上运行,直到我手动停止服务器并重新启动。
我目前在班上使用slf4j记录器: 尽管我在代码中使用替换,如下所示: 请在下面检查我的登录配置: 即使我使用的是最新的稳定版本slf4j 1 . 7 . 25 ,< code > { } 仍然没有被正确替换。 以下文本是logger.info的输出: “用户{}成功登录到系统” 我使用LoggerFactory创建记录器: