在 Jetty 中运行 servlet 时获取 HTTP 500 [英] Getting HTTP 500 when running servlet in Jetty

查看:37
本文介绍了在 Jetty 中运行 servlet 时获取 HTTP 500的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在几天前运行良好的 servlet.但我唯一改变的是我用于 maven 的 nexus repo.我正在通过 mvn jetty:run

I have a servlet that was running fine until a few days ago. But the only thing that I've changed is the nexus repo I'm using for maven. I'm running the servlet via mvn jetty:run

但是当我尝试访问该站点而不是查看主页时,我看到:

But when I try to access the site instead of seeing the home page, I see:

HTTP ERROR 500

Problem accessing /. Reason:

    jregex/Pattern

我可以访问其他网址,例如/favicon.ico.但是我在这个 jregex/Pattern 错误中找不到任何内容,而且代码中根本没有使用 jregex 库.

I can access other url's fine such as /favicon.ico. But I can't find anything on this jregex/Pattern error and it doesn't look like the jregex library is being used in the code at all.

我也没有在日志中看到任何问题.看起来对主页的请求没有发送到我的 servlet,但对其他页面的请求是.

I also don't see any problems in the logs. It looks like requests for the homepage are not making it to my servlet but requests for other pages are.

这在 Arch Linux 和 Mac OS X 10.7 上都会发生

This is happening on both Arch Linux and Mac OS X 10.7

这几乎肯定是一个依赖问题,因为在用一个旧的(依赖于旧的 nexus 服务器)替换我的 ~/.m2 文件夹后,它可以工作.

This is almost certainly a dependency issue because after replacing my ~/.m2 folder with an old one (with dependencies from the old nexus server) it works.

有时我也会得到:

HTTP ERROR: 503

Problem accessing /. Reason:

    SERVICE_UNAVAILABLE

推荐答案

我将从比较您更改 之前和之后创建的 ear/war 文件开始>pom.xml.这应该会引导您找到已更改的 jar 文件.假设一切都是开源的,从 maven repo 下载源代码并进行比较.

I would start with comparing the ear / war file created before and after you changed your pom.xml. This should lead you to jar files that were changed. Assumming everything is open source, download sources from maven repo and compare them.

JRegex 是一个支持 Perl 正则表达式的 Java 库.也许更改 maven repo 会导致下载其他版本的依赖项,并且它们对 JRegex 有一些可选的依赖项.(你应该可以检查一下).

JRegex is a java library with Perl regexp support. Perhaps changing maven repo caused downloading other versions of your dependencies, and they have some optional dependency to JRegex. (You should be able to check that).

尝试将 JRegex 添加到您的依赖项中,看看会发生什么.(请注意,如果您在生产中并且赶时间,这可能是一种解决方法)

Try adding JRegex to your dependencies and see what happens. (Note this whould be a workaround if you're in production and in a hurry)

这篇关于在 Jetty 中运行 servlet 时获取 HTTP 500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆