码头 - noSuchMethodError

发布于 2024-08-10 19:55:43 字数 530 浏览 6 评论 0原文

运行 mvn jetty:run-war 时出现以下错误:(

2009-11-14 15:19:28.459:/:INFO:  Initializing Spring root WebApplicationContext
* ERROR 15:19:28,491 Context initialization failed (ContextLoader.java [main])
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V
...

不包括整个堆栈跟踪)

我知道代码没有任何问题,因为它在 Windows 和 OSX 中都运行得很好。现在我使用 Ubuntu karmic koala 并通过 apt-get 安装了 maven,是否有什么我忘记在 Linux 中配置以使其工作?执行 mvn clean install 时我没有收到任何错误。

有人吗?

I get the following error when running mvn jetty:run-war:

2009-11-14 15:19:28.459:/:INFO:  Initializing Spring root WebApplicationContext
* ERROR 15:19:28,491 Context initialization failed (ContextLoader.java [main])
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V
...

(Not including the whole stacktrace)

I know that there is nothing wrong with the code as it works perfectly fine both in Windows and OSX. Right now Im using Ubuntu karmic koala and installed maven through apt-get, could there be something that I have forgotten to configure in linux to make it work? I dont get any errors when doing mvn clean install.

Anyone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

姜生凉生 2024-08-17 19:55:43

一定是某个地方存在兼容性不匹配的情况。也许您的本地存储库包含某些 jar 的“过时”版本。我建议使用新鲜干净的本地存储库重试。

首先,制作备份副本:

mv ~/.m2/repository ~/.m2/repository.save

然后重试。

There must be a compatibility mismatch somewhere. Maybe your local repository contains a "stale" version of some jar. I'd suggest to retry with a fresh and clean local repository.

First, make a backup copy:

mv ~/.m2/repository ~/.m2/repository.save

Then, try again.

治碍 2024-08-17 19:55:43

我认为问题出在本地存储库上。
我猜你的 Maven 存储库会像 root/.m2/repository 一样存储
旧的 jar 可能是问题

我猜你已经编写了 Jetty 依赖项,如下所示

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <webAppSourceDirectory>WebContent</webAppSourceDirectory>
                <!-- <classesDirectory>WebContent/WEB-INF/classes</classesDirectory> -->
                <!-- Redeploy every 1 seconds if changes are detected, 0 for no automatic 
                    redeployment -->
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <!-- reload manually by hitting enter on console -->
                <reload>manual</reload>
                <webApp>
                    <contextPath>/</contextPath>
                    <descriptor>WebContent/WEB-INF/web.xml</descriptor>
                </webApp>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
                        <port>8080</port>
                        <maxIdleTime>600000</maxIdleTime>
                    </connector>
                </connectors>
            </configuration>
        </plugin>

检查“mvn install”是否成功然后运行 ​​Jetty。

I think the issue is with local repository.
I guess your maven repo would have stored like root/.m2/repository
Old jar may be the issue

I guess you have written Jetty depandencies like below

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <webAppSourceDirectory>WebContent</webAppSourceDirectory>
                <!-- <classesDirectory>WebContent/WEB-INF/classes</classesDirectory> -->
                <!-- Redeploy every 1 seconds if changes are detected, 0 for no automatic 
                    redeployment -->
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <!-- reload manually by hitting enter on console -->
                <reload>manual</reload>
                <webApp>
                    <contextPath>/</contextPath>
                    <descriptor>WebContent/WEB-INF/web.xml</descriptor>
                </webApp>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
                        <port>8080</port>
                        <maxIdleTime>600000</maxIdleTime>
                    </connector>
                </connectors>
            </configuration>
        </plugin>

Check if the the "mvn install" is a Sucess then run Jetty.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文