构建使用 Axis2 的 WAR Tomcat 的壁垒

发布于 2024-08-11 02:08:43 字数 3468 浏览 5 评论 0原文

我正在尝试使用 Rampart 构建基于轴的 Web 服务 安全性,我一直希望对tomcat部署一场战争, 而不是安装轴并在轴内部署。 (我没固定 不过……这对我来说都是非常新的领域,所以我可以 使用您可能拥有的任何反馈。)

我遇到了一些问题:

  • mvn jetty:run 工作正常 - 我可以使用 Web 服务,并且 通过点击我的服务的 url 并添加 ?wsdl 来检索 wsdl 最后(例如: http://localhost:8080/webservice/services/ResultService?wsdl “webservice”是这个项目的名称),但是,mvn jetty:run-war 失败,除非我手动将 Rampart-1.4.mar 和 rahas-1.4.mar 复制到 首先手动打开 WEB-INF/lib 目录。如果没有做到这一点,那么 jetty:run-war 产生一系列有关 Rampart 模块的异常 不可用,并且点击与上面相同的 wsdl url 返回一个 空白页。 (根本没有内容,而它应该是一大块 WSDL) 这是堆栈跟踪: http://hpaste.org/fastcgi/hpaste.fcgi/view? id=12058#a12058

  • 无论生成的war中mar文件的位置如何, 我一直无法让tomcat提供网络服务 适当地。它不会向日志发出任何值得注意的信息(只是一个 INFO Web 应用程序已部署),并且没有提供 wsdl 上面的网址。 http://localhost:8180/infoassist/services/ResultService?wsdl 返回 没有什么。 (“infoassist.war”是生成的战争的名称,因此 与 jetty 不同的 url)

如果我查询不以 ?wsdl 结尾的 url,那么我会得到一个轴 浏览器中的异常。这可能没什么问题——甚至会发生 运行功能码头时:运行服务器,我不期望 浏览器中的“真实”输出还没有,因为到目前为止我所做的一切都是 只是为了测试肥皂。它确实表明该轴正在与 Tomcat 一起使用 不过,至少一些战争依赖正在发挥作用:

org.apache.axis2.AxisFault: The service cannot be found for the
endpoint reference (EPR) /infoassist/ at
org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:65)
at org.apache.axis2.engine.Phase.invoke(Phase.java:334) at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251) at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160) at
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:838)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:262)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

我真的抓住了救命稻草——任何帮助都会很大 感谢,当然,我可以提供更多细节,我只是 不知道会有什么用。

I'm trying to build an axis-based web service with rampart for
security, and I've been hoping to deploy a single war to tomcat,
rather than installing axis and deploying within axis. (I'm not fixed
on that though... this is all very new territory for me, so I could
use any feedback that you might have.)

I'm running into a few problems:

  • mvn jetty:run works fine -- I can use the web service, and
    retrieve wsdl by hitting the url for my services with a ?wsdl tacked
    on the end (eg:
    http://localhost:8080/webservice/services/ResultService?wsdl
    "webservice" is the name of this project), however, mvn jetty:run-war
    fails, unless I manually copy rampart-1.4.mar and rahas-1.4.mar into
    the WEB-INF/lib directory manually first. If that isn't done, then
    jetty:run-war produces a series of exceptions about rampart modules
    not being available, and hitting the same wsdl url as above returns an
    empty page. (no content at all, when it should be a good chunk of
    wsdl)
    Here are the stacktraces:
    http://hpaste.org/fastcgi/hpaste.fcgi/view?id=12058#a12058

  • Regardless of the location of the mar files in the generated war,
    I have never been able to get tomcat to serve the web service
    properly. It does not issue anything of note to the log (just an INFO
    that the web application was deployed), and no wsdl is provided for
    the urls above.
    http://localhost:8180/infoassist/services/ResultService?wsdl returns
    nothing. ('infoassist.war' is the name of the generated war, hence the
    different url than with jetty)

If I query a url that does not end in ?wsdl, then I get an axis
exception in the browser. This is probably fine -- it happens even
when running the functional jetty:run server, and I don't expect
"real" output in a browser yet, since everything I've done so far is
just to test soap. It does indicate that axis is in use with Tomcat
though, so at least some of the war dependencies are working:

org.apache.axis2.AxisFault: The service cannot be found for the
endpoint reference (EPR) /infoassist/ at
org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:65)
at org.apache.axis2.engine.Phase.invoke(Phase.java:334) at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251) at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160) at
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:838)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:262)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

I'm really grasping at straws here -- any help would be greatly
appreciated, and of course, I can provide many more details, I just
don't know what will be of use.

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

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

发布评论

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

评论(2

浅笑轻吟梦一曲 2024-08-18 02:08:43

提出问题后提出建议。

问:您是通过 eclipse 生成 WSDL 的吗?如果是这样,您是否确保它是正确的 Axis 版本?

S:我会将所有内容放入 EAR 中,我相信 tomcat 支持它。 EAR 是一个可以容纳多个 WAR 和 JAR 的目录

Question followed by a suggestion.

Q: Did you generate the WSDL through eclipse? If so did you ensure that it is the right version of Axis?

S: I would drop everything into an EAR, which I believe tomcat supports. An EAR is a directory that can house multiple WARs and JARs

你好,陌生人 2024-08-18 02:08:43

在各种来源的大力帮助下,我找到了答案:

首先,

请遵循以下说明:

但是,在构建 axis war 时,您必须首先调整构建,以便 axis2-codegen-1.5.jar 从存档中排除,按照此处的说明:

要在 Axis2 服务器安装中使用 Rampart 代码,您需要创建一个新的 axis2.war 文件,其中包含添加的 Rampart .jar 和 .mar 文件。您可以使用 webapp 目录中提供的 Ant build.xml 来创建 axis2.war,前提是您进行一项更改:删除行接近文件末尾。然后打开 Axis2 webapp 目录的控制台并运行 ant。 build.xml运行后,您可以在Axis2安装dist目录中找到创建的axis2.war Web应用程序。

这应该足以在轴管理页面的加载模块列表中看到壁垒(可能位于 http://localhost:8080/axis2/axis2-admin/listModules 但是,如果您使用这些库的二进制发行版 (axis/rampart),您还必须注意将代码编译为与 1.5 兼容的 java 类规范,因此我一直遇到 java.lang.UnsupportedClassVersionError 错误,但没有任何说明到底是什么导致了问题 - 我怀疑 axis2-codegen-1.5.jar,这是一个红鲱鱼——问题实际上与我编译的类文件的字节码版本有关,当我从发行版构建壁垒样本时也会发生这种情况,因为它们是以源代码形式分发的。 ,我的默认编译器是java 1.6。

I figured it out, with significant help from various sources:

First,

Follow these instructions:

However, when building the axis war, you must first tweak the build so that axis2-codegen-1.5.jar is not excluded from the archive, per the instructions here:

To use the Rampart code in an Axis2 server installation, you need to create a new axis2.war file, one that includes the added Rampart .jar and .mar files. You can use the Ant build.xml provided in the webapp directory to create axis2.war, provided you make one change: delete the line <exclude name="axis2-codegen*.jar"/> near the end of the file. Then open a console to the Axis2 webapp directory and run ant. After the build.xml runs, you can find the created axis2.war Web application in the Axis2 installation dist directory.

That should be sufficient to see rampart in the list of loaded modules from the axis admin page (which is probably at http://localhost:8080/axis2/axis2-admin/listModules. However, if you're using the binary distributions of these libraries (axis/rampart) you must also take care that you compile your code to a java class spec. that is compatible with 1.5. I wasn't doing this, so I kept encountering java.lang.UnsupportedClassVersionError errors, but nothing made it clear what was actually causing the problem -- I suspected the axis2-codegen-1.5.jar, which was a red-herring--the issues was actually with the bytecode version of my complied classfiles. This also happened when I built the rampart samples from the distribution because they were distributed in source form, and my default compiler is java 1.6.

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