5 Replies Latest reply on Dec 20, 2012 3:01 PM by Jon Wiest

    Seam 2.3 @In not creating StatusMessages

    Jon Wiest Newbie

      I'm in the process of migrating several apps from Seam 2.1.1 + JBoss 4.2.0, to Seam 2.3 + JBoss 7.1.1.  The @In annotation no longer creates objects as needed, whether "(create=true)" is added or not the object is always null.  The workaround for custom objects is creating them inline, but this is not possible for StatusMessages.  The code is as simple as it gets, and is still created the same way using seam-gen 2.3:

       

      @In StatusMessages statusMessages;

       

      I'm wondering if there is .jar I'm missing or an .xml file I haven't converted properly yet, or...?

        • 1. Re: Seam 2.3 @In not creating StatusMessages
          Jon Wiest Newbie

          There is a workaround for StatusMessages, I missed the StatusMessages.instance() method.  The messages don't display, however, which suggests another problem.  And in any case, forced object construction shouldn't be necessary.

          • 2. Re: Seam 2.3 @In not creating StatusMessages
            Martin Kouba Master

            Hi Jon,

            please add some example code snippet and packaging information - not enough information to detect the problem . Seam bijection should work in AS7. I'm not sure about the seam-gen stuff though...

            • 3. Re: Seam 2.3 @In not creating StatusMessages
              Jon Wiest Newbie

              Thanks Martin, wasn't sure how much to add, there's not much to the code, it came straight out of seamgen.  I've also noticed that @Logger injection isn't working, the log object is always null.

               

              The relevant code is:

               

              {code}

              @SuppressWarnings("serial")

              @Stateful

              @Name("search")

              @Scope(ScopeType.SESSION)

              public class SearchAction implements Search, Serializable

              {

                  @Logger private Log log;

               

                  @PersistenceContext(type=PersistenceContextType.EXTENDED, unitName="sqlServer")

                  private EntityManager sqlServerManager;

               

                  @PersistenceContext(type=PersistenceContextType.EXTENDED, unitName="epic")

                  private EntityManager epicManager;

               

                  @In StatusMessages statusMessages;

               

                  @In(create=true) @Out

                  private SearchCriteria searchCriteria = new SearchCriteria();  // <-- under Seam 2.1.1, didn't have to construct this, it's named object

               

                  public String search() {

                      boolean isEmptyPersonId = StringUtils.isEmpty(searchCriteria.getPersonId());

                      boolean validationErrors = false;

                      if (!isEmptyPersonId &&

                              !NumberUtils.isDigits(searchCriteria.getPersonId()))

                      {

                          statusMessages.add(Severity.WARN, "Person ID must be numeric");  // <-- this throws a null pointer unless I contruct with StatusMessages.instance();

                          validationErrors = true;

                      }

                      if (validationErrors) {

                          log.info("Validation errors: " + statusMessages.toString());  // <-- this throws a null pointer unless I construct with Logging.getLog(class);

                          return null;

                      }

               

                      /* process... */

                      return "success";

                  }

               

                  @Remove

                  public void remove() {}   // <-- this even throws a null pointer when I shut down JBoss

              }

              {code}

               

              The @Remove null pointer exception is:

               

               

              {code}

              11:42:30,074 WARN  [org.jboss.seam.Component] Exception calling stateful session bean default @Remove method: search: java.lang.NullPointerE

              xception

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:301) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextIntercepto

              r.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Fi

              nal.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.F

              inal.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-

              as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Fin

              al]

                      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

               

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.stateful.StatefulComponentIdInterceptor.processInvocation(StatefulComponentIdInterceptor.java:52) [jb

              oss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Fin

              al]

                      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

               

                      at org.ecmc.borraccess.service.Search$$$view2.remove(Unknown Source) [baadmin.jar:]

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_35]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_35]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_35]

                      at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]

                      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54) [jboss-seam.jar:2.3.0.Final]

                      at org.javassist.tmp.java.lang.Object_$$_javassist_seam_3.remove(Object_$$_javassist_seam_3.java)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_35]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_35]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_35]

                      at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]

                      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.Component.callComponentMethod(Component.java:2313) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.Component.callDefaultRemoveMethod(Component.java:2218) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.Component.destroy(Component.java:1486) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:290) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:295) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.contexts.ServletLifecycle.endSession(ServletLifecycle.java:187) [jboss-seam.jar:2.3.0.Final]

                      at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:59) [jboss-seam.jar:2.3.0.Final]

                      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:690) [jbossweb-7.0.13.Final.jar:]

                      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:653) [jbossweb-7.0.13.Final.jar:]

                      at org.apache.catalina.session.StandardManager.stop(StandardManager.java:676) [jbossweb-7.0.13.Final.jar:]

                      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3995) [jbossweb-7.0.13.Final.jar:]

                      at org.jboss.as.web.deployment.WebDeploymentService.stop(WebDeploymentService.java:108) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911)

                      at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]

               

              I've seen other messages that @EntityManager doesn't work either, you have to use @PersistenceContext, which I was luckily using already in this project.

              (edit:  I meant @In EntityManager...)

               

              I've add the app's .xml files, if there is anything else that would be helpful please let me know, thanks!

              • 4. Re: Seam 2.3 @In not creating StatusMessages
                Jon Wiest Newbie

                One more piece of info, WEB-INF/lib files are as listed in the attached deployed-jars-war.list; the ear /lib contains the files in deployed-jars-ear.list

                • 5. Re: Seam 2.3 @In not creating StatusMessages
                  Jon Wiest Newbie

                  Unbelievable:  ejb-jar.xml was not built into my app.jar.