我正在尝试在tomcat上部署我的战争6.我已将war
复制到/usr/local/tomcat6/weapps
目录。
然而浏览到localhost:8080/my-app
给我这个错误:
type Exception report
message Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: java.lang.NoSuchMethodException: com.opensymphony.module.sitemesh.factory.DefaultFactory.<init>(com.opensymphony.module.sitemesh.Config)
description The server encountered an internal error that prevented it from fulfilling this request.
exception
com.opensymphony.module.sitemesh.factory.FactoryException: Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: java.lang.NoSuchMethodException: com.opensymphony.module.sitemesh.factory.DefaultFactory.<init>(com.opensymphony.module.sitemesh.Config)
com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:53)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.initContentProcessor(SiteMeshFilter.java:107)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:54)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:139)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
有人可以告诉我一些我遗失的地方吗?
我的pom:
<?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.vantage.flip-club</groupId>
<artifactId>flip-club</artifactId>
<version>1.0.2-SNAPSHOT</version>
<name>Flip Club</name>
<packaging>war</packaging>
<scm>
<connection>
scm:svn:svn://svn.vantage.com/digitalsports/filp-club/trunk
</connection>
<developerConnection>
scm:svn:svn://svn.vantage.com/digitalsports/filp-club/trunk
</developerConnection>
<url>http://svn.vantage.com/websvn2/listing.php?repname=DigitalSports+Repository</url>
</scm>
<properties>
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vantage.vlibrary.version>1.0-SNAPSHOT</vantage.vlibrary.version>
<commons-lang3.version>3.1</commons-lang3.version>
<commons-httpclient.version>3.1</commons-httpclient.version>
<springframework.version>3.2.2.RELEASE</springframework.version>
<springsecurity.version>3.1.4.RELEASE</springsecurity.version>
<crowd.version>2.7.0</crowd.version>
<jsp.version>2.2</jsp.version>
<jstl.version>1.2</jstl.version>
<servlet.version>2.5</servlet.version>
<javax-el.version>2.2</javax-el.version>
<jaxb-impl.version>2.2.7</jaxb-impl.version>
<hibernate.version>4.2.2.Final</hibernate.version>
<hibernate-validator.version>4.3.1.Final</hibernate-validator.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<ehcache.version>2.6.5</ehcache.version>
<postgresql.version>9.2-1002.jdbc4</postgresql.version>
<jackson-asl.version>1.9.12</jackson-asl.version>
<json-taglib.version>0.4.1</json-taglib.version>
<sitemesh.version>2.4.2</sitemesh.version>
<packtag.version>3.8</packtag.version>
<logback.version>1.0.12</logback.version>
<slf4j.version>1.7.5</slf4j.version>
<junit.version>4.11</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-impl.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${commons-httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Bean Factory and JavaBeans utilities (depends on spring-core) Define
this if you use Spring Bean APIs (org.springframework.beans.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<!-- BEGIN: Crowd Libraries -->
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>embedded-crowd-api</artifactId>
<version>${crowd.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-api</artifactId>
<version>${crowd.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-client-common</artifactId>
<version>${crowd.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-client-rest</artifactId>
<version>${crowd.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-client-soap</artifactId>
<version>${crowd.version}</version>
</dependency>
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>crowd-integration-springsecurity</artifactId>
<version>${crowd.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-aegis</artifactId>
<version>1.2.6</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- END: Crowd Libraries -->
<!-- HIBERNATE -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Database -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons-dbcp.version}</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<!-- JSON Utilities -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson-asl.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson-asl.version}</version>
</dependency>
<dependency>
<groupId>com.atg</groupId>
<artifactId>json-taglib</artifactId>
<version>${json-taglib.version}</version>
</dependency>
<!-- Various Web Utilities -->
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>${sitemesh.version}</version>
</dependency>
<dependency>
<groupId>packtag</groupId>
<artifactId>packtag</artifactId>
<version>${packtag.version}</version>
</dependency>
<!-- Logging with SLF4J & LogBack -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- Lexipedia http client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.4</version>
</dependency>
<!-- Rest Client -->
<dependency>
<groupId>us.monoid.web</groupId>
<artifactId>resty</artifactId>
<version>0.3.2</version>
</dependency>
<!-- Packaging -->
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-core</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-extensions</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Vantage VLibrary Client -->
<dependency>
<artifactId>vlibrary-module-embedded-client</artifactId>
<groupId>com.vantage</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${war.finalName}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources/${env.resources.dir}</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources/common</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>${server.url}</url>
<server>${server.id}</server>
<path>${server.context}</path>
<update>${webapp.update}</update>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>nexus</id>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
</repository>
<repository>
<id>nexus-snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<id>nexus-snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<!--use the following if you ARE NOT deploying a snapshot version. -->
<repository>
<id>nexus</id>
<name>Vantage Nexus Release Repository</name>
<url>
http://maven2.vantage.com:8080/repo/content/repositories/vantage-release
</url>
</repository>
<!--use the following if you ARE deploying a snapshot version. -->
<snapshotRepository>
<id>nexus-snapshot</id>
<name>Vantage Nexus Snapshot Repository</name>
<url>
http://maven2.vantage.com:8080/repo/content/repositories/vantage-snapshot
</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<!-- USAGE: tomcat7:deploy -Penv-development-flip-club -->
<id>env-development-flip-club</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>env</name>
<value>development-flip-club</value>
</property>
</activation>
<properties>
<env.resources.dir>development</env.resources.dir>
<!-- NOTE: This server url is for tomcat 7 -->
<server.url>http://localhost:8686/manager/text</server.url>
<server.context>/flip-club</server.context>
<server.id>iseek-web</server.id>
<webapp.update>true</webapp.update>
<war.finalName>flip-club</war.finalName>
</properties>
</profile>
<profile>
<!-- USAGE: tomcat7:deploy -Penv-staging-flip-club -->
<id>env-staging-flip-club</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env</name>
<value>staging-flip-club</value>
</property>
</activation>
<properties>
<env.resources.dir>staging</env.resources.dir>
<!-- NOTE: This server url is for tomcat 7 -->
<server.url>http://192.168.8.18:8686/manager/text</server.url>
<server.context>/flip-club</server.context>
<server.id>iseek-web</server.id>
<webapp.update>true</webapp.update>
<war.finalName>flip-club</war.finalName>
</properties>
</profile>
<profile>
<!-- USAGE: tomcat7:deploy -Penv-production-flip-club -->
<id>env-production-flip-club</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env</name>
<value>production-flip-club</value>
</property>
</activation>
<properties>
<env.resources.dir>production</env.resources.dir>
<!-- NOTE: This server url is for tomcat 7 -->
<server.url>http://192.168.16.149:8080/manager/text</server.url>
<server.context>/</server.context>
<server.id>iseek-web</server.id>
<webapp.update>true</webapp.update>
<war.finalName>flip-club</war.finalName>
</properties>
</profile>
</profiles>
</project>
修改
我仍然想知道为什么这会因为chmod a+x
tomcat
{{1}}而没有做到。
答案 0 :(得分:1)
检查包含com.opensymphony.module.sitemesh.factory.DefaultFactory
的jar的版本,并确保它与Spring jar所需的版本兼容。
<强>更新强>
我无法解释为什么chmod
使事情发挥作用。
从Factory.getInstance抛出异常,因此,在java.lang.NoSuchMethodException
扩展的类中缺少默认构造函数时,可能会抛出包含在com.opensymphony.module.sitemesh.factory.FactoryException
中的异常Config
类。
答案 1 :(得分:0)
我认为您使用Spring集成Sitemesh时会出现更多错误。
也许这可以帮到你: https://github.com/JVerstry/Web-Related-Examples/tree/master/Spring-Sitemesh-Integration/
答案 2 :(得分:0)
有趣的是这样做:
chmod a+x tomcatdir/
并重新启动tomcat
确实解决了我的问题:)