6 Replies Latest reply on May 2, 2013 10:04 PM by maran selva

    java.lang.ClassNotFoundException: org.jboss.seam.ui.converter.EntityConverter in Seam 2.3.0.Final

    maran selva Newbie

        Hi,

       

              I need to use two entity manager. so i used component in componet.xml as follows.

       

      component.xml

      ====================

      <transaction:entity-transaction entity-manager="#{entityManager}"  />

            <persistence:managed-persistence-context name="entityManager"  auto-create="true"

                                    persistence-unit-jndi-name="java:/seamspaceEntityManagerFactory"/>

      <transaction:entity-transaction entity-manager="#{chemBldataManager}"  />

           <persistence:managed-persistence-context name="chemBldataManager" auto-create="true"

                                          persistence-unit-jndi-name="java:/chemBldataBaseEntityManagerFactory"/>

       

        <component name="chemBldataManagerConverter"

                class="org.jboss.seam.ui.converter.EntityConverter" auto-create="true">

                <property name="entityManager">#{chemBldataManager}</property>

        </component>

      ------------------------------------------------------------------------------------------------------------------------------------------------

      and in my Xhtml i am using <f:converter>

      as follows.

       

         <h:selectOneMenu id="cAssa"  value="#{chemblassay.assay_id}"  style=" width : 130px;" required="true" requiredMessage="ERROR" validatorMessage="ERROR">

                        <f:selectItem itemLabel="Choose" itemValue="null" />

                                      <f:selectItems id="cassay" value="#{rtpChemblAction.allChemblAssayDesc}"  var="c" itemLabel="#{c.description}"   itemValue="#{c.assay_id}" />

                                            <f:validateRequired />

                      <f:converter converterId="chemBldataManagerConverter" />

                                                                  </h:selectOneMenu>

                                                                  <rich:message for="loprop" />

       

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------

      in my pom.xml i am using the following dependency..

       

         <dependency>

                  <groupId>org.jboss.seam</groupId>

                  <artifactId>jboss-seam-ui</artifactId>

                  <version>${seam.version}</version>

                  <exclusions>

                      <exclusion>

                          <groupId>javax.faces</groupId>

                          <artifactId>jsf-api</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

       

      ----------------------------------------------------------------------------------------

       

       

      but if i go to my \.m2\repository\org\jboss\seam\jboss-seam-ui\2.3.0.Final\jboss-seam-ui-2.3.0.Final   does not contain the Entityconverter class how can i use

      two entity manager in seam 2.3.0

       

      pls help me.

        • 1. Re: java.lang.ClassNotFoundException: org.jboss.seam.ui.converter.EntityConverter in Seam 2.3.0.Final
          Tomas Remes Expert

          I think that the class FQN is org.jboss.seam.ui.EntityConverter and not org.jboss.seam.ui.converter.EntityConverter.

          • 2. Re: java.lang.ClassNotFoundException: org.jboss.seam.ui.converter.EntityConverter in Seam 2.3.0.Final
            maran selva Newbie

            Thanks Tomas,

             

             

                                         you are correct the EntityConverter avilable in org.jboss.seam.ui,

             

            can you help me on how to set two persistence unit to call two different database in Seam2.3.0.Final , i am confused.

             

            but  now  after replacing the correct path ,

            <component name="chemBldataManagerConverter"

                      class="org.jboss.seam.ui.EntityConverter" auto-create="true">

                      <property name="entityManager">#{chemBldataManager}</property>

              </component>

             

            i got and Runtime error message on Jboss console as,

             

            Caused by: java.lang.IllegalArgumentException: no such field: org.jboss.seam.ui.EntityConverter.entityManager

             

            yes as per this error Entity converter in Seam 2.3.0.Final doesnot have EntityManger it has only EntityLoader method,

            so then i try the following Link,

             

            http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/controls.html

             

            33.1.2.2. <s:convertEntity>

             

            in componet.xml

            ==================

            <transaction:entity-transaction entity-manager="#{entityManager}"  />

                  <persistence:managed-persistence-context name="entityManager"  auto-create="true"

                                          persistence-unit-jndi-name="java:/seamspaceEntityManagerFactory"/>

             

             

            <transaction:entity-transaction entity-manager="#{chemBldataManager}"  />

                 <persistence:managed-persistence-context name="chemBldataManager" auto-create="true"

                                                persistence-unit-jndi-name="java:/chemBldataBaseEntityManagerFactory"/>

             

              <ui:entity-converter name="chemBldataConverter" entity-loader="#{chemBldataLoader}" />

              <ui:jpa-entity-loader name="chemBldataLoader" entity-manager="#{chemBldataManager}" />

             

            -------------------------------------------------------------------------------------------------------------------------------------------------------------

             

            and in my Xhtml

            ==============

            <h:selectOneMenu id="cAssa" value="#{chemblassay.assay_id}" style=" width : 130px;" required="true" requiredMessage="ERROR" validatorMessage="ERROR">

                      <f:selectItem itemLabel="Choose" itemValue="null" />

                                            <s:selectItems id="cassay" value="#{rtpChemblAction.allChemblAssayDesc}" var="c" itemLabel="#{c.description}" itemValue="#{c.assay_id}" />


                 <f:validateRequired />

                 <s:convertEntity />

            </h:selectOneMenu>

             

            ------------------------------------------------------------------------------------------------------------------------------------------------------------

             

            if i ran the Jbos As 7.0 server i got the following error when load the page.

             

            Caused by: java.lang.NumberFormatException: For input string: "null"

                    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) [rt.jar:1.7.0_10]

                    at java.lang.Integer.parseInt(Integer.java:492) [rt.jar:1.7.0_10]

                    at java.lang.Integer.<init>(Integer.java:677) [rt.jar:1.7.0_10]

                    at org.jboss.seam.ui.EntityIdentifierStore.get(EntityIdentifierStore.java:46) [jboss-seam-ui-2.3.0.Final.jar:2.3.0.Final]

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_10]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_10]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_10]

                    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_10]

                    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.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:2.3.0.Final]

            • 5. Re: java.lang.ClassNotFoundException: org.jboss.seam.ui.converter.EntityConverter in Seam 2.3.0.Final
              Tomas Remes Expert

              Ok I've taken a quick look at your files and I would have few suggestions, however I don't think that these are causing the problems.  At first your datasources are set for MySQL, but the hibernate.dialect in your persistence is set to h2 dialect. At second I would suggest to use jpa 2.0 and at third you don't really need to specify:

               

              <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>

               

              if you are using Hibernate 4 or higher. Can you also post sources for Compound_Properties, Assays entities?

              • 6. Re: java.lang.ClassNotFoundException: org.jboss.seam.ui.converter.EntityConverter in Seam 2.3.0.Final
                maran selva Newbie

                Thanks you vey much Tomas for the reply.

                 

                i will work on the suggestion given by you and let you know if it is working ,

                 

                and also i have attached source for  Compound_Properties, Assays entities