jboss上的struts2应用
这是在jboss上部署struts应用的延续,但它足够不同我觉得有必要提出一个新问题。
在另一个问题中,我之前使用的是 struts,但现在我使用的是 struts 2。 此处的教程分为 struts 教程和 struts2 教程。
我发现我需要将 JAVA_HOME 设置为指向 jdk6,否则 struts 2 示例将无法工作。因此,在 eclipse 中,我将另一个 JBoss 服务器添加到我的 JBoss 服务器视图中(我正在使用 JBoss 工具)并使其使用 jdk1.6。
我的问题是,这正常吗? struts 2需要jdk6吗?
[编辑] 堆栈跟踪很大,我将其第一部分粘贴在下面:
2009-11-22 05:13:42,625 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Parsing configuration file [struts.xml]
2009-11-22 05:13:42,890 DEBUG [com.opensymphony.xwork2.util.LocalizedTextUtil] Added default resource bundle 'org/apache/struts2/struts-messages' to default resource bundles = [org/apache/struts2/struts-messages, com/opensymphony/xwork2/xwork-messages]
2009-11-22 05:13:43,093 DEBUG [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Loaded [BUILDER] {PackageConfig Name:struts-default namespace: parents:[]}
2009-11-22 05:13:43,203 DEBUG [com.opensymphony.xwork2.validator.DefaultValidatorFactory] Loading validator definitions.
2009-11-22 05:13:43,281 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,281 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,296 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,328 DEBUG [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Loaded [BUILDER] {PackageConfig Name:convention-default namespace: parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}
2009-11-22 05:13:43,500 ERROR [STDERR] java.lang.Exception: Could not load invoker/war/WEB-INF/classes/org/jboss/invocation/http/servlet/InvokerServlet$GetCredentialAction.class
2009-11-22 05:13:43,500 ERROR [STDERR] at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:745)
2009-11-22 05:13:43,500 ERROR [STDERR] at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:148)
2009-11-22 05:13:43,500 ERROR [STDERR] at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:295)
2009-11-22 05:13:43,500 ERROR [STDERR] at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:277)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:52)
2009-11-22 05:13:43,515 ERROR [STDERR] at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:200)
2009-11-22 05:13:43,515 ERROR [STDERR] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3722)
This is a bit of a continuation of deploy struts app on jboss, but it's different enough that I felt it warranted a new question.
In the other question, I was working with struts, but now I'm working with struts 2.
The tutorials here are broken up into struts tutorials and struts2 tutorials.
What I'm finding is that I need to have JAVA_HOME set to point to a jdk6 or the struts 2 samples won't work. So in eclipse, I added another JBoss Server to my JBoss Server View (I'm using JBoss tools) and made it use jdk1.6.
My question is, is this normal? Does struts 2 require jdk6?
[EDIT]
The stack trace is huge, I'm pasting the first part of it below:
2009-11-22 05:13:42,625 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Parsing configuration file [struts.xml]
2009-11-22 05:13:42,890 DEBUG [com.opensymphony.xwork2.util.LocalizedTextUtil] Added default resource bundle 'org/apache/struts2/struts-messages' to default resource bundles = [org/apache/struts2/struts-messages, com/opensymphony/xwork2/xwork-messages]
2009-11-22 05:13:43,093 DEBUG [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Loaded [BUILDER] {PackageConfig Name:struts-default namespace: parents:[]}
2009-11-22 05:13:43,203 DEBUG [com.opensymphony.xwork2.validator.DefaultValidatorFactory] Loading validator definitions.
2009-11-22 05:13:43,281 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,281 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,296 DEBUG [com.opensymphony.xwork2.interceptor.I18nInterceptor] new I18nInterceptor()
2009-11-22 05:13:43,328 DEBUG [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] Loaded [BUILDER] {PackageConfig Name:convention-default namespace: parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}
2009-11-22 05:13:43,500 ERROR [STDERR] java.lang.Exception: Could not load invoker/war/WEB-INF/classes/org/jboss/invocation/http/servlet/InvokerServlet$GetCredentialAction.class
2009-11-22 05:13:43,500 ERROR [STDERR] at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:745)
2009-11-22 05:13:43,500 ERROR [STDERR] at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:148)
2009-11-22 05:13:43,500 ERROR [STDERR] at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:295)
2009-11-22 05:13:43,500 ERROR [STDERR] at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:277)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:52)
2009-11-22 05:13:43,515 ERROR [STDERR] at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:200)
2009-11-22 05:13:43,515 ERROR [STDERR] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
2009-11-22 05:13:43,515 ERROR [STDERR] at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3722)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,Struts 2 不需要 Java 6,只需要 Java 5(甚至可以是 向后移植到 Java 1.4 但这是另一个故事了)。
也就是说,根据您提供的跟踪,约定插件似乎试图与服务器中部署的其他元素混淆,
invoker/war/WEB-INF/classes/org/jboss/inspiration/http /servlet/InvokerServlet$GetCredentialAction.class
在您的情况下,它找到了一个它认为是操作的类。这实际上是 Jboss 4.2.3.GA 和约定插件 2.1.6 的一个众所周知的问题。在 这个帖子 中引用 Chris Vogel 面临同样的问题问题(Weblogic):AFAIK,有两种解决方案:
PS:我已经成功地重现了您所描述的行为(使用 JDK 6),我在日志中发现了相同的跟踪,但这似乎并没有阻止应用程序工作(正如我所写,XWork 的开发人员仅更改了日志记录)版本 2.1.3 中的级别)。这也是你所观察到的吗?
No, Struts 2 doesn't require Java 6 but Java 5 only (and can even be backported to Java 1.4 but this is another story).
That said, according to the trace you provided, it seems that the convention plug-in is trying to mess with other elements deployed in the server,
invoker/war/WEB-INF/classes/org/jboss/invocation/http/servlet/InvokerServlet$GetCredentialAction.class
in your case, it found a class that it thinks is an action. This is actually a well known problems with Jboss 4.2.3.GA and the convention plug-in 2.1.6. Quoting Chris Vogel in this thread that faced the same problem (with Weblogic):AFAIK, there are two solutions:
PS: I've successfully reproduced the behavior you describe (with a JDK 6), I find the same trace in my logs, but this doesn't seem to prevent the application from working (as I wrote, XWork's developer only changed the logging level in version 2.1.3). Is this what you observe too?
根据 Struts 2 页面,仅需要 Java 5。我已经有一段时间没有使用 Struts 2 了,但几年前我确实将它与 Tomcat + Java 5 一起使用,并且没有遇到这个问题。当您不使用 Java 6 时会遇到什么异常?
Per the Struts 2 page, only Java 5 is required. I haven't used Struts 2 in a while, but I did use it with Tomcat + Java 5 a few years ago and didn't run into this problem. What exception do you get when you're not using Java 6?