< - 我的控制台输出 - >
09:04:10,286 DEBUG SessionBindingConversationManager:99 - Unlocking conversation 1
09:04:11,479 DEBUG FlowHandlerMapping:108 - Mapping request with URI '/arcindex/app/main' to flow with id 'main'
09:04:11,481 DEBUG FlowExecutorImpl:161 - Resuming flow execution with key 'e1s2
09:04:11,481 DEBUG SessionBindingConversationManager:67 - Locking conversation 1
09:04:11,482 DEBUG DefaultFlowExecutionRepository:106 - Getting flow execution with key 'e1s2'
09:04:11,482 DEBUG FlowDefinitionRegistryImpl:59 - Getting FlowDefinition with id 'main'
09:04:11,487 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded [2] of possible 2 listeners for this execution request for flow 'main', the listeners to attach are list[org.springframework.webflow.persistence.JpaFlowExecutionListener@4145582, org.springframework.faces.webflow.FlowFacesContextLifecycleListener@52f9cbe5]
09:04:11,488 DEBUG FlowExecutionImpl:249 - Resuming in org.springframework.webflow.mvc.servlet.MvcExternalContext@4614ac54
09:04:11,489 DEBUG Flow:636 - Restoring [FlowVariable@450ae3fb name = 'user', valueFactory = [BeanFactoryVariableValueFactory@4dfd9726 type = UserEntity]]
ez09:04:11,581 DEBUG FlowExecutionImpl:590 - Attempting to handle [org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'SignUp' of flow 'main'] with root cause [java.lang.NullPointerException]
09:04:11,582 DEBUG FlowExecutionImpl:611 - Rethrowing unhandled flow execution exception
09:04:11,582 DEBUG SessionBindingConversationManager:99 - Unlocking conversation 1
16.Ara.2013 09:04:11 org.apache.catalina.core.StandardWrapperValve invoke
16.Ara.2013 05:02:56 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Spring MVC Dispatcher Servlet threw exception
java.lang.NullPointerException
at
com.gen.spring.services.imp.userServiceImp.checkAvailable(userServiceImp.java:65)
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.apache.el.parser.AstValue.invoke(AstValue.java:191)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47)
at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113)
at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:106)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:760)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at org.springframework.faces.webflow.FlowLifecycle.invokePhase(FlowLifecycle.java:127)
at org.springframework.faces.webflow.FlowLifecycle.execute(FlowLifecycle.java:70)
at org.springframework.faces.webflow.JsfView.processUserEvent(JsfView.java:120)
at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:226)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
05:03:09,792 DEBUG FlowHandlerMapping:108 - Mapping request with URI '/arcindex/app/main' to flow with id 'main'
05:03:09,793 DEBUG FlowExecutorImpl:161 - Resuming flow execution with key 'e1s2
05:03:09,793 DEBUG SessionBindingConversationManager:67 - Locking conversation 1
05:03:09,794 DEBUG DefaultFlowExecutionRepository:106 - Getting flow execution with key 'e1s2'
05:03:09,794 DEBUG FlowDefinitionRegistryImpl:59 - Getting FlowDefinition with id 'main'
05:03:09,800 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded [2] of possible 2 listeners for this execution request for flow 'main', the listeners to attach are list[org.springframework.webflow.persistence.JpaFlowExecutionListener@10bfb545, org.springframework.faces.webflow.FlowFacesContextLifecycleListener@1a15cd9a]
05:03:09,800 DEBUG FlowExecutionImpl:249 - Resuming in org.springframework.webflow.mvc.servlet.MvcExternalContext@5ab04589
05:03:09,801 DEBUG Flow:636 - Restoring [FlowVariable@3157457b name = 'user', valueFactory = [BeanFactoryVariableValueFactory@5892a78b type = UserEntity]]mgk
05:03:09,846 DEBUG FlowExecutionImpl:590 - Attempting to handle [org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'SignUp' of flow 'main'] with root cause [java.lang.NullPointerException]
05:03:09,846 DEBUG FlowExecutionImpl:611 - Rethrowing unhandled flow execution exception
05:03:09,847 DEBUG SessionBindingConversationManager:99 - Unlocking conversation 1
< -My SignUp.xhtml用户名输入并检查错误 - >
<h:panelGroup>
<h:outputText value="Kullanıcı Adı:" />
<h:outputText style="color:red" value="* " />
</h:panelGroup>
<p:inputText id="kad" label="Kullanıcı Adı" value="#{user.kad}"
required="true" title="Kullanıcı Adını giriniz!">
<f:validateLength minimum="2" />
<p:ajax event="keyup" update="kadMsj" global="false" listener="#
{userService.checkAvailable}" />
</p:inputText>
<h:panelGroup>
&lt; - 检查可用 - &gt;
public boolean checkAvailable(AjaxBehaviorEvent event) {
InputText inputText = (InputText) event.getSource();
String value = (String) inputText.getValue();
System.out.print(value);
boolean available = userDao.checkAvailable(value);
if (!available) {
FacesMessage message = constructErrorMessage(null, String.format(getMessageBundle().getString("userExistsMsg"), value));
getFacesContext().addMessage(event.getComponent().getClientId(), message);
} else {
FacesMessage message = constructInfoMessage(null, String.format(getMessageBundle().getString("userAvailableMsg"), value));
getFacesContext().addMessage(event.getComponent().getClientId(), message);
}
return available;
}
&lt; - WEB.XML - &gt;
<servlet>
<servlet-name>Resources Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resources Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
我正在尝试制作一个注册页面。我想获得primefaces输入值并将它们写入数据库。当我输入一个值时,除了一个字符之外没有异常,但仍然无效。随着字符数量的增加,错误会自行刷新。如何解决此错误?