appfuse 部署到tomcat报错

来源:互联网 发布:mac无鼠标右键 编辑:程序博客网 时间:2024/04/29 16:12

appfuse3 部署到Eclipse中,使用jetty启动时,没有错误;

使用maven 打成war包部署到 tomcat 中就是报错 :

jkd 1.7    + tomat 6  ; 

错误1 :

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext-dao.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;

解决:

The idea proposed by SuperEb was right! I compared the list of dependencies in the file "org.eclipse.wst.common.component" with the list of dependencies in target/myproject/WEB-INF/lib. I found a spring-2.0.3.jar that has nothing to do here. This dependency is used by spring modules validation. It was supposed to be excluded by mvn when playing eclipse:eclipse because of a "*" exclusion but it did not work.

Finally I replaced:

<dependency>    <groupId>org.springmodules</groupId>            <artifactId>spring-modules-validation</artifactId>            <version>${springmodules.validation.version}</version>            <exclusions>                <exclusion>                    <artifactId>*</artifactId>                    <groupId>org.springframework</groupId>                </exclusion>                <exclusion>                    <artifactId>xml-apis</artifactId>                    <groupId>xml-apis</groupId>                </exclusion>            </exclusions>        </dependency>

by

<dependency>        <groupId>org.springmodules</groupId>        <artifactId>spring-modules-validation</artifactId>        <version>${springmodules.validation.version}</version>        <exclusions>            <exclusion>                <artifactId>*</artifactId>                <groupId>org.springframework</groupId>            </exclusion>            <exclusion>                <artifactId>spring</artifactId>                <groupId>org.springframework</groupId>            </exclusion>            <exclusion>                <artifactId>xml-apis</artifactId>                <groupId>xml-apis</groupId>            </exclusion>        </exclusions>    </dependency>


错误2 : Caused by: java.lang.NoSuchFieldError: log   

ERROR [localhost-startStop-1] Digester.endElement(1132) | End event threw exception
java.lang.reflect.InvocationTargetException
        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.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:282)
       。。。。。。。
Caused by: java.lang.reflect.InvocationTargetException
        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.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:282)
        at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:216)
        at org.apache.commons.digester.Rule.end(Rule.java:230)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
        ... 27 more
Caused by: java.lang.NoSuchFieldError: log
        at org.apache.velocity.tools.view.servlet.WebappLoader.init(WebappLoader.java:39)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:144)
        at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522)
        at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:227)
        at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461)
        at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:106)
        at net.sf.navigator.displayer.VelocityMenuDisplayer.initialize(VelocityMenuDisplayer.java:71)
        at net.sf.navigator.menu.MenuRepository.addMenuDisplayerMapping(MenuRepository.java:168)
        ... 35 more


发现web-inf下的lib中有俩个velocity 1.4 和velocity 1.7 

使用 F:\leelwork\wkspace_j2ee_1\fuseappst>mvn dependency:tree    发现 velocity1.4 根本没有依赖的

不知怎么加进来的;

在pom中发现  :

<dependency>
            <groupId>struts-menu</groupId>
            <artifactId>struts-menu</artifactId>
            <version>${struts.menu.version}</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>velocity</groupId>
                </exclusion>
                 
              <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>velocity-tools</groupId>
                </exclusion>
            </exclusions>
        </dependency>

改为如下就可以:

<dependency>
            <groupId>struts-menu</groupId>
            <artifactId>struts-menu</artifactId>
            <version>${struts.menu.version}</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>velocity</groupId>
                </exclusion>
                
                <!-- 对于tomcat部署中保存,发现存在梁velocity1.4和1.7  -->
                <!-- exclusion要特别指定去掉某个依赖? -->
                <exclusion>
                    <artifactId>velocity</artifactId>
                    <groupId>velocity</groupId>
                </exclusion>

                
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>velocity-tools</groupId>
                </exclusion>
            </exclusions>
        </dependency>


这样在编译打包后就没有velocity1.4 了,直接放到tomcat中可以了








0 0
原创粉丝点击