6 Replies Latest reply on Feb 1, 2010 11:57 AM by Md. Kamruzzaman kamrul

    java.lang.IllegalArgumentException: Unknown entity:

    Vasilica Petcu Newbie

      I have a generated entity called Contacts andout it's working fine. I am trying tu use it inside an webservice via the entityhome calling the persist method and it's giving me this error.


      The webservice is working fine without this part.


      Could anyone give me a hint ???

        • 1. Re: java.lang.IllegalArgumentException: Unknown entity:
          Oguzhan YALCIN Newbie

          You'd better put the stack trace for this error.

          • 2. Re: java.lang.IllegalArgumentException: Unknown entity:
            Vasilica Petcu Newbie
            javax.ejb.EJBException: java.lang.IllegalArgumentException: Unknown entity: org.domain.ctiproxy.entity.ContactosUteis
                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:94)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:70)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:108)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:103)
                 at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:220)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:424)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:287)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:197)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:123)
                 at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 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:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.IllegalArgumentException: Unknown entity: org.domain.ctiproxy.entity.ContactosUteis
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)
                 at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:135)
                 at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 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.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                 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.domain.ctiproxy.session.ContactosUteisHome_$$_javassist_5.persist(ContactosUteisHome_$$_javassist_5.java)
                 at pt.itsector.email.webservice.ContactsServiceBean.setContacts(ContactsServiceBean.java:30)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                 at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                 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.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                 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.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                 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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                 at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
                 ... 39 more
            00:06:34,421 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
            javax.ejb.EJBException: java.lang.IllegalArgumentException: Unknown entity: org.domain.ctiproxy.entity.ContactosUteis
                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:94)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:70)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:108)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:103)
                 at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:220)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:424)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:287)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:197)
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:123)
                 at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 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:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.IllegalArgumentException: Unknown entity: org.domain.ctiproxy.entity.ContactosUteis
                 at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)
                 at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:135)
                 at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 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.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                 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.domain.ctiproxy.session.ContactosUteisHome_$$_javassist_5.persist(ContactosUteisHome_$$_javassist_5.java)
                 at pt.itsector.email.webservice.ContactsServiceBean.setContacts(ContactsServiceBean.java:30)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                 at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                 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.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                 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.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                 at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                 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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                 at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
                 ... 39 more
            • 3. Re: java.lang.IllegalArgumentException: Unknown entity:
              Vasilica Petcu Newbie

              package pt.itsector.email.webservice;
              
              import javax.ejb.Stateless;
              import javax.jws.WebMethod;
              import javax.jws.WebResult;
              import javax.jws.WebService;
              
              import org.domain.ctiproxy.session.ContactosUteisHome;
              import org.jboss.seam.annotations.In;
              import org.jboss.seam.annotations.Name;
              import org.jboss.wsf.spi.annotation.WebContext;
              
              @Stateless
              @WebService(name = "ContactsService", serviceName = "ContactsService")
              @WebContext(contextRoot = "/webservices")
              @Name("contactsService")
              public class ContactsServiceBean implements ContactsService {
                   @In(create = true)
                   ContactosUteisHome contactosUteisHome;
              
                   @WebMethod(operationName = "setContacts")
                   @WebResult(name = "setContactsResult")
                   public boolean setContacts(ContactsContainer contactsContainer){
                        boolean output = false;
                        for (int i = 0; i < contactsContainer.getContacts().length; i++) {
                             ContactsContainer.Contact contact = contactsContainer.getContacts()[i];
                             contactosUteisHome.setId(null);
                             contactosUteisHome.getInstance().setDescription(contact.getDescription());
                             contactosUteisHome.getInstance().setNumber(contact.getNumber());
                             contactosUteisHome.persist();
                        }
                        output = true;
                        return output;
                   }
              }
              


              • 5. Re: java.lang.IllegalArgumentException: Unknown entity:
                Vasilica Petcu Newbie

                Nope. That did not resolve my issue:


                persistence.xml


                <?xml version="1.0" encoding="UTF-8"?>
                <!-- Persistence deployment descriptor for dev profile -->
                <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
                             version="1.0">
                             
                   <persistence-unit name="ctiProxy">
                      <provider>org.hibernate.ejb.HibernatePersistence</provider>
                      <jta-data-source>java:/ctiProxyDatasource</jta-data-source>
                       <class>org.domain.ctiproxy.entity.ContactosUteis</class>      
                      <properties>
                         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
                         <property name="hibernate.hbm2ddl.auto" value="update"/>
                         <property name="hibernate.show_sql" value="true"/>
                         <property name="hibernate.format_sql" value="true"/>
                         <property name="jboss.entity.manager.factory.jndi.name" value="java:/ctiProxyEntityManagerFactory"/>
                      </properties>
                   </persistence-unit>
                    
                </persistence>
                


                • 6. Re: java.lang.IllegalArgumentException: Unknown entity:
                  Md. Kamruzzaman kamrul Newbie
                  I was facing same problem. I have solved that addding just a line in persistance.xml of my project. That is:

                  <class>org.domain.manymany.entity.AdminCountryInfo</class>

                  Where AdminCountryInfo is my Entity Class..

                  Entity Class:

                  package org.domain.manymany.entity;

                  import javax.persistence.Column;
                  import javax.persistence.Entity;
                  import javax.persistence.Id;
                  import javax.persistence.Table;
                  import org.hibernate.validator.Length;
                  import org.hibernate.validator.NotNull;

                  @Entity
                  @Table(name = "ADMIN_COUNTRY_INFO", schema = "PLANNING")
                  public class AdminCountryInfo implements java.io.Serializable {

                          private long countryCode;
                          private String nameEng;
                          private String details;
                          private String nameBen;

                          public AdminCountryInfo() {
                          }

                          public AdminCountryInfo(long countryCode, String nameEng) {
                                  this.countryCode = countryCode;
                                  this.nameEng = nameEng;
                          }

                          public AdminCountryInfo(long countryCode, String nameEng, String details,
                                          String nameBen) {
                                  this.countryCode = countryCode;
                                  this.nameEng = nameEng;
                                  this.details = details;
                                  this.nameBen = nameBen;
                          }

                          @Id
                          @Column(name = "COUNTRY_CODE", unique = true, nullable = false, precision = 10, scale = 0)
                          public long getCountryCode() {
                                  return this.countryCode;
                          }

                          public void setCountryCode(long countryCode) {
                                  this.countryCode = countryCode;
                          }

                          @Column(name = "NAME_ENG", nullable = false, length = 100)
                          @NotNull
                          @Length(max = 100)
                          public String getNameEng() {
                                  return this.nameEng;
                          }

                          public void setNameEng(String nameEng) {
                                  this.nameEng = nameEng;
                          }

                          @Column(name = "DETAILS", length = 500)
                          @Length(max = 500)
                          public String getDetails() {
                                  return this.details;
                          }

                          public void setDetails(String details) {
                                  this.details = details;
                          }

                          @Column(name = "NAME_BEN", length = 100)
                          @Length(max = 100)
                          public String getNameBen() {
                                  return this.nameBen;
                          }

                          public void setNameBen(String nameBen) {
                                  this.nameBen = nameBen;
                          }

                  }


                  And session Bean:

                  package org.domain.manymany.session;

                  import javax.persistence.EntityManager;

                  import org.domain.manymany.entity.AdminCountryInfo;
                  import org.domain.manymany.entity.FamsForeignTraining;
                  import org.jboss.seam.ScopeType;
                  import org.jboss.seam.annotations.In;
                  import org.jboss.seam.annotations.Logger;
                  import org.jboss.seam.annotations.Name;
                  import org.jboss.seam.annotations.Out;
                  import org.jboss.seam.annotations.Scope;
                  import org.jboss.seam.log.Log;

                  @Name("testManyToMany")
                  @Scope(ScopeType.SESSION)
                  public class TestManyToMany {
                         
                          private String value;
                         
                          @Logger
                          private Log log;
                         
                          @In(create=true)
                          private EntityManager entityManager;
                         
                          @In(required=false)
                          @Out(required=false)
                          private FamsForeignTraining famsForeignTraining;

                          public String getValue() {             
                                  value="from database";
                                  return value;
                          }

                          public void setValue(String value) {           
                                  this.value = value;
                          }
                          long id=2;
                          public String addValue() {
                                  log.info("inside methods={0}", this.getValue());
                                  id++;
                                  AdminCountryInfo countryInfo= new AdminCountryInfo();
                                  countryInfo.setCountryCode(id);
                                  countryInfo.setDetails("Country Des"+id);
                                  countryInfo.setNameEng("Country Name"+id);
                                  countryInfo.setNameBen("Country Name Ben"+id);
                                  entityManager.persist(countryInfo);
                                  return null;
                          }
                         
                  }

                  persistance.xml:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!-- Persistence deployment descriptor for dev profile -->
                  <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                               version="1.0">
                              
                     <persistence-unit name="manymany" transaction-type="JTA">
                        <provider>org.hibernate.ejb.HibernatePersistence</provider>
                        <jta-data-source>java:/manymanyDatasource</jta-data-source>
                        <class>org.domain.manymany.entity.AdminCountryInfo</class>
                        <properties>
                           <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9iDialect"/>
                           <property name="hibernate.hbm2ddl.auto" value="none"/>
                           <property name="hibernate.show_sql" value="true"/>
                           <property name="hibernate.format_sql" value="true"/>
                           <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) -->
                           <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                        </properties>
                     </persistence-unit>
                     
                  </persistence>










                  component.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:persistence="http://jboss.com/products/seam/persistence"
                              xmlns:drools="http://jboss.com/products/seam/drools"
                              xmlns:bpm="http://jboss.com/products/seam/bpm"
                              xmlns:security="http://jboss.com/products/seam/security"
                              xmlns:mail="http://jboss.com/products/seam/mail"
                              xmlns:web="http://jboss.com/products/seam/web"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:schemaLocation=
                                  "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
                                   http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
                                   http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                                   http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
                                   http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                                   http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                                   http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
                                   http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">

                     <core:init debug="true" jndi-pattern="@jndiPattern@"/>

                     <core:manager concurrent-request-timeout="500"
                                   conversation-timeout="120000"
                                   conversation-id-parameter="cid"
                                   parent-conversation-id-parameter="pid"/>

                     <!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
                     <web:hot-deploy-filter url-pattern="*.seam"/>

                     <persistence:entity-manager-factory name="entityManagerFactory"
                                        persistence-unit-name="manymany"/>

                     <persistence:managed-persistence-context name="entityManager" auto-create="true"
                                            entity-manager-factory="#{entityManagerFactory}"/>

                     <drools:rule-base name="securityRules">
                        <drools:rule-files><value>/security.drl</value></drools:rule-files>
                     </drools:rule-base>

                     <security:rule-based-permission-resolver security-rules="#{securityRules}"/>

                     <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>

                     <event type="org.jboss.seam.security.notLoggedIn">
                        <action execute="#{redirect.captureCurrentView}"/>
                     </event>
                     <event type="org.jboss.seam.security.loginSuccessful">
                        <action execute="#{redirect.returnToCapturedView}"/>
                     </event>

                     <mail:mail-session host="localhost" port="25"/>

                     <!-- For use with jBPM pageflow or process management -->
                     <!--
                     <bpm:jbpm>
                        <bpm:process-definitions></bpm:process-definitions>
                        <bpm:pageflow-definitions></bpm:pageflow-definitions>
                     </bpm:jbpm>
                     -->

                  </components>