8 Replies Latest reply on Aug 4, 2011 4:44 AM by Sebastian Sachtleben

    Excepetion in Tomcat 7+Seam3 project.

    hantsy bai Master


      javax.el.PropertyNotFoundException: /resetPassword.xhtml @26,94 value="#{resetPasswordAction.resetPwdEmail}": Target Unreachable, identifier 'resetPasswordAction' resolved to null
           at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
           at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
           at javax.faces.component.UIInput.validate(UIInput.java:960)
           at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
           at javax.faces.component.UIInput.processValidators(UIInput.java:698)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
           at javax.faces.component.UIForm.processValidators(UIForm.java:253)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
           at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)
           at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
           at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
           at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
           at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
           at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
           at java.lang.Thread.run(Thread.java:662)




      The resetPassword.xhtml code:




      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:s="http://jboss.org/seam/faces"
                      xmlns:p="http://java.sun.com/jsf/composite/components/property"
                      template="/WEB-INF/templates/default.xhtml">
      
          <ui:define name="content">
      
              <div class="section">
                  <h1>Reset Your Password</h1>
              </div>
      
              <div class="section">
      
                  <div class="errors"><h:messages id="messages" globalOnly="true" />
                  </div>
      
                  <h:form id="pwdForm" prependId="false">
      
                      <fieldset>
                          <p:input id="current" label="Eamil">
                              <h:inputText id="input" value="#{resetPasswordAction.resetPwdEmail}">
                                  <f:validator validatorId="emailExistenceValidator" />
                              </h:inputText>
                          </p:input>
      
      
                          <div class="buttonBox"><h:commandButton id="change"
                                                                  value="Change" action="#{resetPasswordAction.resetPassword}" />
                              #{' '} <h:button id="cancel" value="Cancel" outcome="/index.xhtml" /></div>
                      </fieldset>
      
                  </h:form>
      
              </div>
      
          </ui:define>
      
          <ui:define name="sidebar">
              <div class="content">
                  <h1>Simple things should be easy</h1>
                  <p>(And so should some complex things.) You shouldn't have to
                write four different classes just to change a password. Traditional
                J2EE architectures require that developers spend more time writing
                code to make the frameworks happy, than they ever get to spend writing
                code to make the user happy. Seam lets you reduce the size of your
                code dramatically. And that reduces bugs. And it makes refactoring
                easier. And it makes delivering new functionality quicker.
                Productivity matters. But with Seam, JSF, EJB 3.0 and jBPM, you don't
                need to sacrifice the ability to handle complex problems just to
                achieve great productivity.</p>
              </div>
          </ui:define>
      
      </ui:composition>
      



      RestPasswordAction




      @Named(value = "resetPasswordAction")
      @SessionScoped
      public class ResetPasswordAction implements Serializable {
      
          @Inject
          private Instance<MailMessage> mailMessage;
          @Inject
          private ResourceProvider resourceProvider;
          @Inject
          private Instance<TemplateCompiler> templateCompiler;
          @Inject
          private Instance<Session> session;
          @NotNull
          @Email
          private String resetPwdEmail;
          @Inject
          UserService userService;
          @Inject
          Messages messages;
      
          public String getResetPwdEmail() {
              return resetPwdEmail;
          }
      
          public void setResetPwdEmail(String resetPwdEmail) {
              this.resetPwdEmail = resetPwdEmail;
          }
      
          @Transactional()
          public void resetPassword() {
              User user = userService.findUserByEmail(resetPwdEmail);
              String newPassword = "2222cc";
              user.setPassword(newPassword);
              try {
                  sendNewPassword(user.getUsername(), newPassword);
              } catch (MalformedURLException ex) {
                  Logger.getLogger(ResetPasswordAction.class.getName()).log(Level.SEVERE, null, ex);
              }
              messages.info(new DefaultBundleKey("account_passwordReset")).defaults("New password was sent to your email, please check it later.");
          }
      
          public void sendNewPassword(String user, String password) throws MalformedURLException {
              mailMessage.get().from("seam@test.test", "Bifincan.com").to(resetPwdEmail).subject("Reset Password").bodyHtml(new RenderTemplate(templateCompiler.get(), "reset-password.html.render")).put("username", user).put("password", password).importance(MessagePriority.HIGH).send(session.get());
          }
      }
      



      In tomcat console, more expcetion info like this:



      [WARNING] [talledLocalContainer] 严重: Exception sending request initialized lif
      ecycle event to listener instance of class org.jboss.weld.environment.servlet.Li
      stener
      [WARNING] [talledLocalContainer] org.jboss.weld.context.ContextNotActiveExceptio
      n: WELD-001303 No active contexts for scope type javax.enterprise.context.Reques
      tScoped
      [WARNING] [talledLocalContainer]        at org.jboss.weld.manager.BeanManagerImp
      l.getContext(BeanManagerImpl.java:667)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.bean.proxy.ContextBean
      Instance.getInstance(ContextBeanInstance.java:77)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.bean.proxy.ProxyMethod
      Handler.invoke(ProxyMethodHandler.java:87)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.transaction.EntityTran
      saction$Proxy$_$$_WeldClientProxy.isActive(EntityTransaction$Proxy$_$$_WeldClien
      tProxy.java)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.persistence.ManagedPer
      sistenceContextProxyHandler.closeAfterTransaction(ManagedPersistenceContextProxy
      Handler.java:148)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.persistence.ManagedPer
      sistenceContextProxyHandler.invoke(ManagedPersistenceContextProxyHandler.java:10
      0)
      [WARNING] [talledLocalContainer]        at $Proxy30.closeAfterTransaction(Unknow
      n Source)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.persistence.ManagedPer
      sistenceContextBeanLifecycle.destroy(ManagedPersistenceContextBeanLifecycle.java
      :145)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.persistence.ManagedPer
      sistenceContextBeanLifecycle.destroy(ManagedPersistenceContextBeanLifecycle.java
      :46)
      [WARNING] [talledLocalContainer]        at org.jboss.seam.solder.bean.ImmutableB
      ean.destroy(ImmutableBean.java:92)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.context.ForwardingCont
      extual.destroy(ForwardingContextual.java:34)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.context.AbstractContex
      t.destroy(AbstractContext.java:156)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.context.AbstractContex
      t.destroy(AbstractContext.java:173)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.context.AbstractConver
      sationContext.deactivate(AbstractConversationContext.java:218)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.servlet.WeldListener.r
      equestDestroyed(WeldListener.java:125)
      [WARNING] [talledLocalContainer]        at org.jboss.weld.servlet.api.helpers.Fo
      rwardingServletListener.requestDestroyed(ForwardingServletListener.java:42)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardCont
      ext.fireRequestDestroyEvent(StandardContext.java:6006)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardCont
      extValve.invoke(StandardContextValve.java:172)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.authenticator.Aut
      henticatorBase.invoke(AuthenticatorBase.java:462)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardHost
      Valve.invoke(StandardHostValve.java:164)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.valves.ErrorRepor
      tValve.invoke(ErrorReportValve.java:100)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.valves.AccessLogV
      alve.invoke(AccessLogValve.java:563)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardEngi
      neValve.invoke(StandardEngineValve.java:118)
      [WARNING] [talledLocalContainer]        at org.apache.catalina.connector.CoyoteA
      dapter.service(CoyoteAdapter.java:403)
      [WARNING] [talledLocalContainer]        at org.apache.coyote.http11.Http11Proces
      sor.process(Http11Processor.java:301)
      [WARNING] [talledLocalContainer]        at org.apache.coyote.http11.Http11Protoc
      ol$Http11ConnectionHandler.process(Http11Protocol.java:162)
      [WARNING] [talledLocalContainer]        at org.apache.tomcat.util.net.JIoEndpoin
      t$SocketProcessor.run(JIoEndpoint.java:309)
      [WARNING] [talledLocalContainer]        at java.util.concurrent.ThreadPoolExecut
      or$Worker.runTask(ThreadPoolExecutor.java:886)
      [WARNING] [talledLocalContainer]        at java.util.concurrent.ThreadPoolExecut
      or$Worker.run(ThreadPoolExecutor.java:908)
      [WARNING] [talledLocalContainer]        at java.lang.Thread.run(Thread.java:662)
      
      



      I haved tried Conversation scope and request code on ResetPasswordAction, it does not work.








        • 1. Re: Excepetion in Tomcat 7+Seam3 project.
          Jason Porter Master

          You don't need @Transactional if you're coming through a JSF request with Seam Faces. I don't see anything else that would be a cause for problems. You also only need to specify a value for @Named if you want it something different than the default (simple class name with the first letter lower cased).

          • 2. Re: Excepetion in Tomcat 7+Seam3 project.
            hantsy bai Master

            @Transactional removed.


            The same result.


            I want to know if every module of Seam3 have been test on Servlet Container(NONE JEE enviroment)?


            In these days, I have posted several problem I encountered in Tomcat 6/7 container. I think some of the modules have not been tested in Servlet container.

            • 3. Re: Excepetion in Tomcat 7+Seam3 project.
              Jason Porter Master

              No, many modules are not tested it servlet environment, we're targeting AS7 for the main container in Seam 3.1. You're running in an environment where you have to do all of the integration yourself (one of the main reasons for using a full application server). We'd very much like to support as many configurations as possible, however, we simply do not have enough resources to do it all.


              We very much welcome your contributions, especially in testing. If you would like to help with the effort come to #seam-dev in irc.freenode.net and study up on arquillian to help us out!

              • 4. Re: Excepetion in Tomcat 7+Seam3 project.
                hantsy bai Master

                Thanks for ur reply.


                I would like introduce Seam 3 in our current project, but the customer seems to be stuck with Tomcat as runtime container and he did not want to use Jboss at all.


                If Weld/Seam3 design is flexible as it was declared. I think Seam 3 team must prepare test environment for Servlet and JEE container at the same time.


                Ideally , the core module(Solder module) should be in charge for detection the feature availability of the container, such as transaction, ejb, schedule, etc(I had seen some detection info when tomcat starts up), other modules are based on the core api and care little about container itself.


                I hope in the future Seam 3 development progress, more application servers will be considered as test environment.


                I have filed all the problems I encountered in these days on Seam 3 JIRA.



                • 5. Re: Excepetion in Tomcat 7+Seam3 project.
                  Jason Porter Master

                  If Tomcat is a must (I must say I don't fully understand shops like this (yes, I've worked in some as well), JBoss is actually built on top of Tomcat, and AS7 has a smaller footprint and is all-around faster than tomcat as well. Oh well.) I would recommend looking at TomEE

                  • 6. Re: Excepetion in Tomcat 7+Seam3 project.
                    Thierry Ler Newbie

                    Same situation here. I have to use Tomcat because my client does not want to install Jboss. In fact my client does not want to ask our hosting provider to get jboss. My client thinks that it is too complicate (if the provider have to learn and bla bla bla). And we do not even know if the provider allready have jboss or not... Arf. My client said I can ask for jboss if i can't do only with the cat. So I have to come back with very good reasons. Of course I can't say that all Seam 3 does not work on tomcat because my client will tell to switch into spring...

                    • 7. Re: Excepetion in Tomcat 7+Seam3 project.
                      hantsy bai Master

                      I have moved to Spring 3(Spring 3,Spring Security 3, Primefaces, JPA2) now, I do not want to waste time on Seam 3 and tomcat, I hope use Seam 3 in future, maybe it become more mature at that time.


                      Seam 3 is so stuck with JBoss application server.


                      My before code is based on the Booking example, even it is simple, but it dose not work.
                      Such as ResetPasswordAction(either session scope or request scope) here, Seam does not prepare an object at runtime, I added @PostContruct to debug it, I can see the debug info when entered the page, so the exception here is threw.


                      Another class, PasswordManager, which is also from Booking example, can not work correctly in Tomcat, I must implement Serializer interface and change the scope to SessionScoped, it will work. Why? Only because it injected a SessionScoped user property? I can not understand.


                      I am not sure if all of modules are tested on Tomcat container before, till I got fatal error when configured Security and Rest module, I am sure these two are NOT tested on Tomcat.



                      • 8. Re: Excepetion in Tomcat 7+Seam3 project.
                        Sebastian Sachtleben Novice

                        Well that is sad. Anyway Sun prefer their Glassfish and Red Hat prefer their Jboss AS. I think its quite normal. And I really have to say I would like to have an optimized framework for one application server instead of working unstable on several application servers.


                        I can suggest 1and1 cloud servers. Runs like a beast since weeks without any downtime. :)