5 Replies Latest reply on Apr 9, 2008 8:41 AM by Krunoslav Samardzic

    Possibile bug seam 2.0.2 CR1

    Krunoslav Samardzic Newbie

      Problem happens when using s:convertEntity


      stackTrace:


      12:13:59,789 [http-127.0.0.1-8080-1]  WARN javax.enterprise.resource.webcontainer.jsf.lifecycle :103 - executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@6f86710) threw exception
      java.lang.NullPointerException
           at org.jboss.seam.ui.converter.entityConverter.EntityLoader.getPersistenceContext(EntityLoader.java:30)
           at org.jboss.seam.ui.converter.entityConverter.EntityLoader.getPersistenceContext(EntityLoader.java:24)
           at org.jboss.seam.ui.converter.entityConverter.AbstractEntityLoader.put(AbstractEntityLoader.java:46)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at org.jboss.seam.ui.converter.entityConverter.EntityLoader_$$_javassist_15.put(EntityLoader_$$_javassist_15.java)
           at org.jboss.seam.ui.converter.EntityConverter.getAsString(EntityConverter.java:77)
           at org.jboss.seam.ui.converter.PrioritizableConverter.getAsString(PrioritizableConverter.java:67)
           at org.jboss.seam.ui.converter.ConverterChain.getAsString(ConverterChain.java:123)
           at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:521)
           at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:532)
           at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.renderSelectOptions(HtmlRendererUtils.java:410)
      12:13:59,790 [http-127.0.0.1-8080-1] TRACE org.jboss.seam.jsf.SeamPhaseListener :181 - after phase: RENDER_RESPONSE 6
      12:13:59,791 [http-127.0.0.1-8080-1] DEBUG org.jboss.seam.jsf.SeamPhaseListener :607 - rolling back transaction after phase: RENDER_RESPONSE 6
      12:13:59,792 [http-127.0.0.1-8080-1] DEBUG org.jboss.seam.core.Manager :333 - Storing conversation state: 7
      


      JSP page:



      <t:selectOneMenu id="selectOperater" value="#{traziLog.operater}">
                     <s:selectItems value="#{traziOperater.rezultati}" var="z"
                          noSelectionLabel="#{messages['zajednicke.nijeOdabrano']}"
                          label="#{z.ime} #{z.prezime}" />
                     <s:convertEntity />
                </t:selectOneMenu>
      




      This example works fine in seam 2.0.0 GA.
      Thanks in advance Kruno.

        • 1. Re: Possibile bug seam 2.0.2 CR1
          Pete Muir Master

          Can we see your components.xml please?

          • 2. Re: Possibile bug seam 2.0.2 CR1
            Krunoslav Samardzic Newbie

            my Components.xml:


            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
                 xmlns:core="http://jboss.com/products/seam/core"
                 xmlns:async="http://jboss.com/products/seam/async"
                 xmlns:security="http://jboss.com/products/seam/security"
                 xmlns:transaction="http://jboss.com/products/seam/transaction"
                 xmlns:persistence="http://jboss.com/products/seam/persistence"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:bpm="http://jboss.com/products/seam/bpm"
                 xmlns:web="http://jboss.com/products/seam/web"
                 xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                                http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd
                            http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
                            http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd
                            http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd 
                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
            
            
                 <core:init jndi-pattern="kadrovska/#{ejbName}/local" />
            
                 <core:manager conversation-timeout="1800000" />
                 <core:manager concurrent-request-timeout="600000" />
            
                 <async:quartz-dispatcher />
            
                 <persistence:managed-persistence-context name="manager"
                      auto-create="true"
                      persistence-unit-jndi-name="java:/EntityManagerFactories/kadrovska" />
            
                 <component name="org.jboss.seam.ui.EntityConverter">
                      <property name="entityManager">#{manager}</property>
                 </component>
            
            
                 <transaction:ejb-transaction />
            
                 <security:identity authenticate-method="#{auth.login}" />
            
                 <bpm:jbpm>
                      <bpm:pageflow-definitions>
            
                           <value>/pageflows/core/pocetna/pocetna.jpdl.xml</value>
                           <value>
                                /pageflows/core/postavke/postavkeKorisnik.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/postavke/postavkeCron.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/batchObrade/sifBatchObrada.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/batchObrade/sifIzvBatchObrada.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/korisnik/korisnik.jpdl.xml
                           </value>
            
                           <value>
                                /pageflows/core/maticni/operater/operater.jpdl.xml
                           </value>
            
                           <value>
                                /pageflows/core/maticni/katalog/katalog.jpdl.xml
                           </value>
                           <value>/pageflows/core/maticni/posao/posao.jpdl.xml</value>
            
                           <value>
                                /pageflows/core/maticni/sifarnici/simple/sifarnik.jpdl.xml
                           </value>
                           <value>/pageflows/core/kruno.jpdl.xml</value>
            
                           <value>
                                /pageflows/core/syncSupra/servisi/servisi.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/sifarnici/drzava/drzava.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/sifarnici/zupanija/zupanija.jpdl.xml
                           </value>
            
                           <value>
                                /pageflows/core/maticni/sifarnici/opcina/opcina.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/sifarnici/mjesto/mjesto.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/organizacija/radnaJedinica/radnaJedinica.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/organizacija/obracunskaJedinica/obracunskaJedinica.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/organizacija/lokacija/lokacija.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/organizacija/odjel/odjel.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/poduzeca/vrstaRacuna/vrstaRacuna.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/poduzeca/djelatnost/djelatnost.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/maticni/poduzeca/poduzece/poduzece.jpdl.xml
                           </value>
                           <value>/pageflows/core/error/error.jpdl.xml</value>
                           <value>
                                /pageflows/core/alati/upravljanjePoslovima.jpdl.xml
                           </value>
                           <value>/pageflows/core/alati/email.jpdl.xml</value>
                           <value>/pageflows/core/alati/hql.jpdl.xml</value>
                           <value>/pageflows/core/alati/log.jpdl.xml</value>
                           <value>
                                /pageflows/kadrovska/natjecaji/natjecaj/natjecaj.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/osoba/osoba.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/zaposlenik/zaposlenik.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/zaposlenik/izvjestajZaposlenik.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/kriterij/kriterij.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/radnoMjesto/radnoMjesto.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/satnica/satnica.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/stopaOlaksica/stopaOlaksica.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/zdravSposobnost/zdravSposobnost.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/strucSprema/strucSprema.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/postavke/postavkeOperater.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/straniJezik/straniJezik.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/vrstaInvalidnosti/vrstaInvalidnosti.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/vrstaSkole/vrstaSkole.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/doprinosi/doprinos/doprinos.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/doprinosi/doprinosStavka/doprinosStavka.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/doprinosi/grupaDoprinosa/grupaDoprinosa.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/zajmodavac/zajmodavac.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/zakonskePostavke/zakonskePostavke.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/obustava/obustava.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/rasporedPoreza/rasporedPoreza.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/sifarnici/vrstaObrade/vrstaObrade.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/sifarnici/vrstaPrimanja/vrstaPrimanja.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/supra/supraDrzava/supraDrzava.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/supra/supraOpcina/supraOpcina.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/sifarnici/supra/supraMjesto/supraMjesto.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/reports/reportsKadrovska.jpdl.xml
                           </value>
                           <value>
                                /pageflows/kadrovska/maticni/zaposlenik/ispisUgovora.jpdl.xml
                           </value>
                           <value>
                                /pageflows/core/postavke/preference/preferenceClass.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/sifarnici/vrstaKredita/vrstaKredita.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/sifarnici/vrsteUplateRs/vrstaUplateRs.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/sifarnici/rasporedPlaca/rasporedPlaca.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/racun/racun.jpdl.xml
                           </value>
                           <value>
                                /pageflows/place/dokumentIsplate/dokumentIsplate.jpdl.xml
                           </value>
                      </bpm:pageflow-definitions>
                 </bpm:jbpm>
                 <event type="org.jboss.seam.beginConversation">
                      <action execute="#{beginConversationEvent.startKonverzacije}" />
            
                 </event>
            
                 
            
            
            
            </components>
            
            


            • 3. Re: Possibile bug seam 2.0.2 CR1
              Pete Muir Master

              Ok, please file an issue in JIRA, and I will take a look for CR2.


              Thanks!

              • 4. Re: Possibile bug seam 2.0.2 CR1
                Clint Popetz Apprentice

                I think this is only an issue for SMPCs that aren't named entityManager, and is due to changes for JBSEAM-1242 which replaced EntityConverterStore with EntityLoader and HibernateEntityLoader.  It used to be sufficient to put:


                    <component name="org.jboss.seam.ui.EntityConverter">
                        <property name="entityManager">#{yourEM}</property>
                    </component>
                



                in your components.xml to make the converter find the right EM.  Now entityManager lookup is delegated, and
                EntityLoader in particular is hardcoded to always look for a component named entityManager.  I think that's probably incorrect, and so I've created JBSEAM-2863


                As a workaround, if you put:


                <factory name="entityManager" scope="stateless" auto-create="true" value="#{myEM}"/>
                



                in your components.xml, it will give you the correct behavior.  Or, at least it did for me.





                • 5. Re: Possibile bug seam 2.0.2 CR1
                  Krunoslav Samardzic Newbie

                  Thanks a lot workaround worked for me to.
                  I suppose  the problem lies in:


                  @Name("org.jboss.seam.ui.entityLoader")
                  @Install(precedence=BUILT_IN)
                  @Scope(STATELESS)
                  public class EntityLoader extends AbstractEntityLoader<EntityManager>
                  {
                       
                    ...
                  
                     @Override
                     protected String getPersistenceContextName()
                     {
                        return "entityManager";
                     }
                  ...