appfuse 部署到tomcat报错

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中可以了








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值