JBoss AS7でSAStrutsが動かず
JBoss AS4系で動かしていたSeasarベースのアプリをそろそろJBoss AS7に移行するかもしれないなんて話が出てきたので、そもそも動くのかどうか単純なSAStrutsのサンプルで検証してみた。結果、JBoss AS5の頃にVFS対応されていましたが、7では見事に動かず。。。
試した手順
MavenでSAStrutsのサンプルアプリを生成
mvn archetype:generate -DarchetypeRepository=https://www.seasar.org/maven/maven2/ \ -DarchetypeGroupId=org.seasar.sastruts \ -DarchetypeArtifactId=sa-struts-archetype -DarchetypeVersion=1.0.4-sp9 \ -DgroupId=org.example.sastuts -DartifactId=sastruts-sample -Dversion=1.0
ビルド
mvn package
でtarget/sastruts-sample.warができる。
デプロイ!
できたWARファイルを$JBOSS_HOME/standalone/deploymentsにコピーしてデプロイする。
結果、以下のようにvfs:・・・というプロトコルが解釈できずにエラーになる。
18:42:38,332 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "sastruts-sample.war" 42.351: [GC 42.351: [ParNew: 117354K->13056K(118016K), 0.0836350 secs] 117354K->31464K(511232K), 0.0836940 secs] [Times: user=0.20 sys=0.03, real=0.08 secs] 18:42:39,151 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry commons-beanutils.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 18:42:39,152 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry commons-digester.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 18:42:39,152 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry commons-fileupload.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 18:42:39,153 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry commons-logging.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 18:42:39,154 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry commons-validator.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 18:42:39,155 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry jakarta-oro.jar in "/content/sastruts-sample.war/WEB-INF/lib/struts-1.2.9.jar" does not point to a valid jar for a Class-Path reference. 43.114: [GC 43.114: [ParNew: 118016K->13056K(118016K), 0.0759070 secs] 136424K->56906K(511232K), 0.0759690 secs] [Times: user=0.19 sys=0.01, real=0.08 secs] 18:42:40,014 INFO [org.seasar.struts.validator.S2ValidatorPlugIn] (MSC service thread 1-5) Loading validation rules file from '/WEB-INF/validator-rules.xml' 18:42:40,082 INFO [org.seasar.framework.container.factory.SingletonS2ContainerFactory] (MSC service thread 1-5) s2-frameworkのバージョンは2.4.44です。 18:42:40,084 INFO [org.seasar.framework.container.factory.SingletonS2ContainerFactory] (MSC service thread 1-5) s2-extensionのバージョンは2.4.44です。 18:42:40,085 INFO [org.seasar.framework.container.factory.SingletonS2ContainerFactory] (MSC service thread 1-5) s2-tigerのバージョンは2.4.44です。 18:42:40,270 WARN [org.seasar.framework.util.ResourcesUtil] (MSC service thread 1-5) ルートパッケージ(org.example.sastruts)に対応するURL(vfs:/content/sastruts-sample.war/WEB-INF/classes/org/example/sastruts/)のプロトコルが不明です。 18:42:40,272 WARN [org.seasar.framework.util.ResourcesUtil] (MSC service thread 1-5) ルートパッケージ(org.example.sastruts)に対応するリソースがクラスパスから見つかりませんでした。 18:42:40,392 WARN [org.seasar.framework.util.ResourcesUtil] (MSC service thread 1-5) ルートパッケージ(org.example.sastruts)に対応するURL(vfs:/content/sastruts-sample.war/WEB-INF/classes/org/example/sastruts/)のプロトコルが不明です。 18:42:40,393 WARN [org.seasar.framework.util.ResourcesUtil] (MSC service thread 1-5) ルートパッケージ(org.example.sastruts)に対応するリソースがクラスパスから見つかりませんでした。 18:42:40,398 WARN [org.seasar.framework.container.assembler.BindingTypeShouldDef] (MSC service thread 1-5) org.seasar.extension.dbcp.impl.ConnectionPoolImplのプロパティ(XADataSource)が見つからないので設定をスキップします 18:42:40,402 WARN [org.seasar.framework.util.ResourcesUtil] (MSC service thread 1-5) ルートパッケージ(null)に対応するURL(vfs:/content/sastruts-sample.war/WEB-INF/lib/s2-tiger-2.4.44.jar/)のプロトコルが不明です。 18:42:40,404 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sastruts-sample]] (MSC service thread 1-5) StandardWrapper.Throwable: java.lang.NullPointerException at org.seasar.framework.container.autoregister.ComponentAutoRegister.registerAll(ComponentAutoRegister.java:62) [s2-framework-2.4.44.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05] at org.seasar.framework.util.MethodUtil.invoke(MethodUtil.java:96) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.assembler.AbstractMethodAssembler.invoke(AbstractMethodAssembler.java:94) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.assembler.DefaultInitMethodAssembler.assemble(DefaultInitMethodAssembler.java:49) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.assemble(SingletonComponentDeployer.java:69) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.deploy(SingletonComponentDeployer.java:48) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.init(SingletonComponentDeployer.java:76) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.ComponentDefImpl.init(ComponentDefImpl.java:236) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:563) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:560) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:560) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.factory.SingletonS2ContainerFactory.init(SingletonS2ContainerFactory.java:167) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.SingletonS2ContainerInitializer.initialize(SingletonS2ContainerInitializer.java:55) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.S2ContainerServlet.initializeContainer(S2ContainerServlet.java:139) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.S2ContainerServlet.init(S2ContainerServlet.java:127) [s2-framework-2.4.44.jar:] at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05] 18:42:40,415 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sastruts-sample]] (MSC service thread 1-5) サーブレット /sastruts-sample がload()例外を投げました: java.lang.NullPointerException at org.seasar.framework.container.autoregister.ComponentAutoRegister.registerAll(ComponentAutoRegister.java:62) [s2-framework-2.4.44.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05] at org.seasar.framework.util.MethodUtil.invoke(MethodUtil.java:96) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.assembler.AbstractMethodAssembler.invoke(AbstractMethodAssembler.java:94) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.assembler.DefaultInitMethodAssembler.assemble(DefaultInitMethodAssembler.java:49) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.assemble(SingletonComponentDeployer.java:69) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.deploy(SingletonComponentDeployer.java:48) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.deployer.SingletonComponentDeployer.init(SingletonComponentDeployer.java:76) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.ComponentDefImpl.init(ComponentDefImpl.java:236) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:563) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:560) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.impl.S2ContainerImpl.init(S2ContainerImpl.java:560) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.factory.SingletonS2ContainerFactory.init(SingletonS2ContainerFactory.java:167) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.SingletonS2ContainerInitializer.initialize(SingletonS2ContainerInitializer.java:55) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.S2ContainerServlet.initializeContainer(S2ContainerServlet.java:139) [s2-framework-2.4.44.jar:] at org.seasar.framework.container.servlet.S2ContainerServlet.init(S2ContainerServlet.java:127) [s2-framework-2.4.44.jar:] at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05] 18:42:40,428 INFO [org.jboss.web] (MSC service thread 1-5) JBAS018210: Registering web context: /sastruts-sample 18:42:40,472 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "sastruts-sample.war
参考
JBoss AS5の頃のVFS対応について。同じように対応すれば動くようになるかな? 試してみよう。