1

可能重复:
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;

2012-12-12 20:35:34,047 INFO  [org.apache.catalina.core.StandardEngine] (main) Starting Servlet Engine: JBoss Web/2.1.10
2012-12-12 20:35:34,094 INFO  [org.apache.catalina.startup.Catalina] (main) Server startup in 87 ms
2012-12-12 20:35:34,125 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/invoker
2012-12-12 20:35:34,640 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/invoker]] (main) Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at com.sun.faces.config.WebConfiguration.getServletContextName(WebConfiguration.java:250)
    at com.sun.faces.config.WebConfiguration.<init>(WebConfiguration.java:100)
    at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:158)
    .
    .
    .
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
2012-12-12 20:35:34,640 ERROR [org.apache.catalina.core.StandardContext] (main) Error listenerStart
2012-12-12 20:35:34,640 ERROR [org.apache.catalina.core.StandardContext] (main) Context [/invoker] startup failed due to previous errors
2012-12-12 20:35:34,718 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=jboss.web.deployment:war=/invoker state=Create mode=Manual requiredState=Installed
org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/http-invoker.sar/invoker.war/ deployment failed
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:342)
    .
    .
    .
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
2012-12-12 20:35:34,749 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/jbossws
2012-12-12 20:35:34,796 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbossws]] (main) Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at com.sun.faces.config.WebConfiguration.getServletContextName(WebConfiguration.java:250)
    at com.sun.faces.config.WebConfiguration.<init>(WebConfiguration.java:100)
    at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:158)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:145)
    at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:60)
    .
    .
    .
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
2012-12-12 20:35:34,796 ERROR [org.apache.catalina.core.StandardContext] (main) Error listenerStart
2012-12-12 20:35:34,796 ERROR [org.apache.catalina.core.StandardContext] (main) Context [/jbossws] startup failed due to previous errors
2012-12-12 20:35:34,796 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=jboss.web.deployment:war=/jbossws state=Create mode=Manual requiredState=Installed
org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/jbossws.sar/jbossws-management.war/ deployment failed
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:342)
    .
    .
    .
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
2012-12-12 20:35:34,796 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/web-console
2012-12-12 20:35:34,827 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/web-console]] (main) Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at com.sun.faces.config.WebConfiguration.getServletContextName(WebConfiguration.java:250)
    .
    .
    .
2012-12-12 20:35:39,199 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Real: name=vfszip:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/RDSGUIWeb.war/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/tmp/5j2at36-3k5zwg-han7uhp7-1-han7uyj0-9u/RDSGUIWeb.war/ deployment failed
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:342)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
    at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
    at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
    at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
    at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
    at $Proxy38.start(Unknown Source)
    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
    at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
    at org.jboss.system.ServiceController.start(ServiceController.java:460)
    at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
    at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
    at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
    at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
    at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
    at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
    at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
    at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
    at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
    at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
    at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:778)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:543)
    at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
2012-12-12 20:35:39,699 INFO  [org.jboss.system.server.profileservice.ProfileServiceBootstrap] (main) Loading profile: ProfileKey@12b7414[domain=default, server=default, name=default]
2012-12-12 20:35:39,699 ERROR [org.jboss.system.server.profileservice.ProfileServiceBootstrap] (main) Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS IN ERROR:
  Deployment "jboss.web.deployment:war=/web-console" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/management/console-mgr.sar/web-console.war/ deployment failed
  Deployment "jboss.web.deployment:war=/jbossws" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/jbossws.sar/jbossws-management.war/ deployment failed
  Deployment "vfszip:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/RDSGUIWeb.war/" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/tmp/5j2at36-3k5zwg-han7uhp7-1-han7uyj0-9u/RDSGUIWeb.war/ deployment failed
  Deployment "jboss.web.deployment:war=/invoker" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/C:/EDM/JBoss-EAP/jboss-eap-5.1/jboss-as/server/default/deploy/http-invoker.sar/invoker.war/ deployment failed

2012-12-12 20:35:39,715 INFO  [org.apache.coyote.http11.Http11Protocol] (main) Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
2012-12-12 20:35:39,746 INFO  [org.apache.coyote.ajp.AjpProtocol] (main) Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
2012-12-12 20:35:39,746 INFO  [org.jboss.bootstrap.microcontainer.ServerImpl] (main) JBoss (Microcontainer) [5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)] Started in 25s:322ms

嗨,当我的 war 文件部署到 jboss 部署文件夹中时,我遇到了一个问题,即部署失败,我确信这与配置和类路径问题有关,但我无法找出导致问题。

这是我遵循的程序/方法。实际上,我正在使用 ant 构建脚本(在 eclipse 中)构建 .WAR 文件。最后,我的 war 文件将不包含 lib 文件夹(这意味着内部没有 .jars,这就是 .WAR 文件不应过重的要求)但是每个 .jar(包括 servlet-api.jar)文件都需要 . WAR 在 jboss 类路径配置中可用,但我在部署时仍然收到错误和异常。请在上面查找日志以获取更多详细信息(已粘贴 server.log 信息)。

注意:在我的 ant 构建脚本中,我没有在内部编译/链接任何类。我的意思是:即使是 ant 文件 .jar 也可以通过 ant 类路径获得。

这是我的 build.xml 的摘要:

<target name="compile" depends="clean, init">
    <javac destdir="${rds.build}" debug="true" srcdir="${rds.src}">
    </javac>
</target>

<target name="war" depends="compile, doTestLevel, doProdLevel">
  <war destfile="${rds.dist.bin}/RDSGUIWeb.war" >
    <fileset dir="${projectRootDir}/WebContent">    
        <include name="**/*"/>
        <exclude name="/WEB-INF/lib/**" />
    </fileset>
    <classes dir="${rds.build}" />
  </war>
</target>

更新:我尝试通过从其类路径中删除 servlet-api.jar 来运行 jboss,此时我将得到类似 com.icesoft.faces.util.event.servlet.ContextEventRepeater 类的应用程序侦听器未实例化的内容。在这两种方式(无论是否包括 servlet-api.jar)我都无法成功。这就是我接近stackoverflow的原因。

4

1 回答 1

0

我将所有 jar 复制到默认文件夹中的lib文件夹(即默认 JBOSS 实例的库文件夹),而不是让它们在 JBOSS 的类路径/构建路径用户条目中可用。终于成功了!!!

于 2012-12-14T02:48:14.787 回答