2011-12-20 63 views
0

我工作的NetBeans IDE 7.0.1添加一個新的Web服務,而這些是我使用的庫:在Struts2的Web應用程序

  • ANTLR-2.7.6.jar
  • commons- BeanUtils的-1.8.1.jar
  • 公地集合-3.2.jar
  • 公共沼氣池-2.0.jar
  • 公地文件上傳-1.2.1.jar
  • 共享記錄-1.0.4。罐子
  • 的dom4j-1.6.1.jar
  • EJB3-persistence.jar
  • freemarker的-2.3.15.jar
  • 休眠的註解 - 3.2.0.ga.jar
  • 休眠公地的註解。罐子
  • 休眠-core.jar添加
  • 的hsqldb.jar
  • 了Javassist-3.9.0.GA.jar
  • JTA-1.1.jar
  • 日誌4J-1.2.15.jar
  • MySQL的連接器的Java-5.1.10-bin.jar
  • OGNL-2.7.3.jar
  • SLF4J-API-1.4.2.jar
  • slf4j- log4j12-1.4.2.jar
  • 的struts2-配置瀏覽器,插件-2.1.6.jar
  • Struts2的核心 - 2.1.8.1.jar
  • Struts2的,泥鰍插件,2.2.3.1.jar
  • XWork的核心 - 2.1.6.jar

我創建了一個Struts2的web應用,以及我在一個新的包通過使用NetBeans嚮導加入web服務web服務;在我struts.xml我用下面的:

<constant name="struts.action.excludePattern" value="/YouSportWS*"/> 

,但是當我點擊測試Web服務在Netbeans的上下文菜單測試我的web服務,我在瀏覽器中得到以下錯誤:

Struts Problem Report 

Struts has detected an unhandled exception: 

Messages: 
controller.MyWebService 
Unable to instantiate Action, controller.YouSportWS, defined for 'YouSportWS' in namespace '/'controller.YouSportWS 
File: org/glassfish/web/loader/WebappClassLoader.java 
Line number: 1.519 

Stacktraces 

Unable to instantiate Action, controller.YouSportWS, defined for 'YouSportWS' in namespace '/'controller.YouSportWS 
    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307) 
    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388) 
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187) 
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) 
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) 
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478) 
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) 
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) 
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) 
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) 
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
    com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 
    com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 
    org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330) 
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
    com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174) 
    com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) 
    com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) 
    com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 
    com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 
    com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    java.lang.Thread.run(Thread.java:722) 

    java.lang.ClassNotFoundException: controller.YouSportWS 
     org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1519) 
     org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1369) 
     com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:146) 
     com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:96) 
     com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:149) 
     com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139) 
     com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109) 
     com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288) 
     com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388) 
     com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187) 
     org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) 
     org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 
     com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) 
     org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478) 
     org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) 
     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) 
     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) 
     org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) 
     org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
     org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
     org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
     com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 
     com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 
     org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 
     org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330) 
     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
     com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174) 
     com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) 
     com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) 
     com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 
     com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 
     com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
     com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
     com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
     com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
     com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
     com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
     com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
     com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
     com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
     java.lang.Thread.run(Thread.java:722) 

我的設置有什麼問題?

回答

0

的模式應該是一個真正的正則表達式:

excludePattern="YouSportWS.*" 

documentation regarding exclusions

+0

我嘗試使用 <常數名= 「struts.action.excludePattern」 值= 「YouSportWS。*」/> 和 <常數名= 「struts.action.excludePattern」 值= 「/ YouSportWS。* /」 /> 但它不工作... – AlexGpeppe 2011-12-20 13:58:02

+0

什麼版本的S2? – 2011-12-20 14:12:53

+0

我正在使用struts2-core-2.1.8.1.jar。 – AlexGpeppe 2011-12-20 14:21:14