我将Tomcat TOMEE PLUS 8.0.0 M2应用程序服务器和Eclipse Oxygen用于我的REST开发。从REST服务类中,我无法调用JSP文件。
如何解决此问题并从服务类中调用JSP?
在REST服务类中:
List<User> userList=userDao.getAllUsers();
URI uri=null;
try
{
uri = new URI("./UserList.jsp");
}
catch (URISyntaxException e) {e.printStackTrace();}
catch (WebApplicationException we) {we.printStackTrace();}
//URI uri = UriBuilder.fromPath("./UserList.jsp").queryParam("ListOfUser",userList).build();
//return Response.seeOther(uri).build();
return Response.temporaryRedirect(uri).build();
最后一行返回的服务器运行时错误:
Mar 10, 2019 7:29:36 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://tutorialspoint.com/}UserService has thrown exception, unwinding now
java.lang.IllegalArgumentException: bean
at org.apache.bval.util.Validate.notNull(Validate.java:38)
at org.apache.bval.jsr.job.ValidateBean.<init>(ValidateBean.java:35)
at org.apache.bval.jsr.job.ValidationJobFactory.validateBean(ValidationJobFactory.java:52)
at org.apache.bval.jsr.ValidatorImpl.validate(ValidatorImpl.java:53)
at org.apache.cxf.validation.BeanValidationProvider.doValidateBean(BeanValidationProvider.java:149)
at org.apache.cxf.validation.BeanValidationProvider.validateReturnValue(BeanValidationProvider.java:135)
at org.apache.cxf.validation.BeanValidationOutInterceptor.handleValidation(BeanValidationOutInterceptor.java:43)
at org.apache.cxf.validation.AbstractValidationInterceptor.handleMessage(AbstractValidationInterceptor.java:83)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:90)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
at org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)