【问题标题】:Java doesnt extract war files and throws exception when deploying on windows tomcatJava在windows tomcat上部署时不提取war文件并抛出异常
【发布时间】:2019-02-06 10:18:47
【问题描述】:

我部署了用eclipse在centos上构建了.war文件,然后将它部署在centos(Linux)上的tomcat 8.5上。它正在解决这个问题。但是,当我在 Windows 上部署相同的“.war”或使用 Eclipse 构建新的“.war”文件时,它在 Tomcat8.5 上不起作用,并且会引发 BeansInCreation 异常。具有相同的Java1.7和Tomcat8.5版本windows7。 该版本还在以前版本的 Windows 上运行(更新前) 并且在最新的代码中没有做任何大的改动。

以下是来自 localhost 的日志:

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name '': Bean with name '' has been injected into other beans ['','',''] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:268)
... 98 more

我认为问题可能是因为“大文件路径”,因为 Linux 支持比 Windows 更多的大文件路径。我在 regedit 中也进行了更改以支持,但这不需要更改。

【问题讨论】:

    标签: java spring windows tomcat centos


    【解决方案1】:

    如果它适用于 linux 但不适用于 windows,我假设在部署您的战争时存在类加载问题(类的顺序)。我建议检查 .war 文件中的 /lib 目录。

    也许它包含来自同一个 jar 的不同版本。

    已编辑:

    您可以在 linux 和 windows 上跟踪 tomcat(或任何 java 应用程序)的类加载。为此,您需要使用特殊的 vm 参数 (-verbose:class) 启动它。看看这里: Java verbose class loading

    【讨论】:

    • 如果这是问题所在,那么为什么相同的“.war”能够在 CentOS 上成功部署,并且文件的先前版本也能够在 Windows 上部署,而我没有进行更改在库中。
    • 也许你的战争一直有这个问题,现在它已经生效了。这只是一个假设,但我自己也有过很多次这样的经历。
    • 那么这与您为克服您所面临的问题所做的解决方案相同吗?检查 jar 的不同版本。
    • 不幸的是,这个问题没有通用的解决方案。您可以尝试在 linux 和 windows 上跟踪 tomcat 的类加载。为此,您需要一个特殊的 vm 参数(-verbose:class)。看看这里:stackoverflow.com/questions/10230279/java-verbose-class-loading
    猜你喜欢
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-02
    • 2010-09-13
    • 2012-07-29
    • 1970-01-01
    相关资源
    最近更新 更多