9 Replies Latest reply on Mar 10, 2006 7:18 PM by gavin.king

    Exception: java.lang.IllegalArgumentException: could not ins

    tschnoelzer

      Hi folks,

      we are using the booking example of seam head and put it into MyEclipse Enterprise Application. When using the native build version of this example, the system is running fine.

      I went for hours now examinating any relevant difference, ot finding any thing. ths jars are the same. the naming is different.

      what is the

      <jboss-app>
      <loader-repository>
      seam.jboss.org:loader=NSDAutomotiveWeb
      </loader-repository>
      </jboss-app>

      for? what entry is expected for the loader???

      Thx for any input

      Timo

      05:06:07,136 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      05:06:07,246 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=BookingListAction with dependencies:
      05:06:07,246 INFO [JmxKernelAbstraction] persistence.units:ear=NSDAutomotive.ear.ear,jar=NSDAutomotiveEJB.jar.jar,unitName=bookingDatabase
      05:06:13,675 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=ChangePasswordAction with dependencies:
      05:06:13,675 INFO [JmxKernelAbstraction] persistence.units:ear=NSDAutomotive.ear.ear,jar=NSDAutomotiveEJB.jar.jar,unitName=bookingDatabase
      05:06:14,256 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=HotelBookingAction with dependencies:
      05:06:14,256 INFO [JmxKernelAbstraction] persistence.units:ear=NSDAutomotive.ear.ear,jar=NSDAutomotiveEJB.jar.jar,unitName=bookingDatabase
      05:06:14,877 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=LoginAction with dependencies:
      05:06:14,877 INFO [JmxKernelAbstraction] persistence.units:ear=NSDAutomotive.ear.ear,jar=NSDAutomotiveEJB.jar.jar,unitName=bookingDatabase
      05:06:15,197 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=LogoutAction with dependencies:
      05:06:15,478 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=EJB3,ear=NSDAutomotive.ear,jar=NSDAutomotiveEJB.jar,name=RegisterAction with dependencies:
      05:06:15,478 INFO [JmxKernelAbstraction] persistence.units:ear=NSDAutomotive.ear.ear,jar=NSDAutomotiveEJB.jar.jar,unitName=bookingDatabase
      05:06:16,079 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.0.x/build/output/jboss-4.0.4beta/server/default/tmp/deploy/tmp54957NSDAutomotive.ear-contents/NSDAutomotiveEJB.jar
      05:06:16,089 INFO [TomcatDeployer] deploy, ctxPath=/NSDAutomotiveWeb, warUrl=.../tmp/deploy/tmp54957NSDAutomotive.ear-contents/NSDAutomotiveWeb-exp.war/
      05:06:16,850 INFO [ServletContextListener] Welcome to Seam 1.0 beta 2
      05:06:16,890 INFO [Initialization] reading properties from: /seam.properties
      05:06:16,900 INFO [Initialization] initializing Seam
      05:06:16,950 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
      05:06:16,980 INFO [Component] Component: org.jboss.seam.core.pages, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Pages
      05:06:17,000 INFO [Component] Component: org.jboss.seam.core.manager, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.Manager
      05:06:17,030 INFO [Component] Component: switcher, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Switcher
      05:06:17,040 INFO [Component] Component: conversation, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Conversation
      05:06:17,060 INFO [Component] Component: conversationList, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationList
      05:06:17,090 INFO [Component] Component: conversationStack, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationStack
      05:06:17,110 INFO [Component] Component: facesContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesContext
      05:06:17,120 INFO [Component] Component: eventContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EventContext
      05:06:17,130 INFO [Component] Component: sessionContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SessionContext
      05:06:17,140 INFO [Component] Component: statelessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.StatelessContext
      05:06:17,150 INFO [Component] Component: applicationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ApplicationContext
      05:06:17,160 INFO [Component] Component: conversationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationContext
      05:06:17,170 INFO [Component] Component: businessProcessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.BusinessProcessContext
      05:06:17,180 INFO [Component] Component: resourceBundle, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ResourceBundle
      05:06:17,200 INFO [Component] Component: org.jboss.seam.debug.introspector, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.debug.Introspector
      05:06:17,250 INFO [ResourceBundle] loaded resource bundle: messages
      05:06:17,280 INFO [Component] Component: org.jboss.seam.debug.contexts, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.debug.Contexts
      05:06:17,300 INFO [Scanner] scanning: /C:/jboss-4.0.x/build/output/jboss-4.0.4beta/server/default/tmp/deploy/tmp54957NSDAutomotive.ear-contents/NSDAutomotiveEJB.jar
      05:06:17,380 INFO [Component] Component: user, scope: SESSION, type: ENTITY_BEAN, class: org.jboss.seam.example.booking.User
      05:06:17,390 INFO [Component] Component: register, scope: EVENT, type: STATEFUL_SESSION_BEAN, class: org.jboss.seam.example.booking.RegisterAction, JNDI: NSDAutomotiveEJB/RegisterAction/local
      05:06:17,400 ERROR [[/NSDAutomotiveWeb]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      java.lang.IllegalArgumentException: could not instantiate ClassValidator
      at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:204)
      at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:165)
      at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:126)
      at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:83)
      at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:156)
      at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:136)
      at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:83)
      at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:72)
      at org.jboss.seam.Component.initValidator(Component.java:218)
      at org.jboss.seam.Component.<init>(Component.java:185)
      at org.jboss.seam.Component.<init>(Component.java:142)
      at org.jboss.seam.Component.<init>(Component.java:137)
      at org.jboss.seam.Component.<init>(Component.java:132)
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:244)
      at org.jboss.seam.init.Initialization.addComponents(Initialization.java:225)
      at org.jboss.seam.init.Initialization.init(Initialization.java:93)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:30)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3692)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4127)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
      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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
      at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.apache.catalina.core.StandardContext.init(StandardContext.java:5031)
      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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
      at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
      at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
      at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
      at org.jboss.web.WebModule.startModule(WebModule.java:83)
      at org.jboss.web.WebModule.startService(WebModule.java:61)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      at sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:974)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
      at $Proxy35.start(Unknown Source)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:469)
      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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
      at $Proxy36.start(Unknown Source)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
      at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
      at $Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:334)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:504)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:207)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:218)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:197)
      Caused by: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key validator.notNull
      at java.util.ResourceBundle.getObject(ResourceBundle.java:326)
      at java.util.ResourceBundle.getString(ResourceBundle.java:286)
      at org.hibernate.validator.ClassValidator.replace(ClassValidator.java:404)
      at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:199)
      ... 102 more


        • 1. Re: Exception: java.lang.IllegalArgumentException: could not
          gavin.king

          Don't worry too much about jboss-app.xml, the app will work fine w/o it, actually. It's just doing scoped classloading. The string is an arbitrary string.

          • 2. Re: Exception: java.lang.IllegalArgumentException: could not
            jgilbert

            I am getting the same error:

            Caused by: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key validator.length

            The booking example works, but my app can't find the resource. From what I can tell they are setup the same and hibernate-annotations.jar is in the lib directory. I get the same result even when I put the annotations jar in my ear.

            I have run out of ideas. Any thoughts?

            • 3. Re: Exception: java.lang.IllegalArgumentException: could not

              You need to provide a value for the message in the Annotation or the messages.properties.


              But even though i have done this, the validation doesn't seem to be working. It allows me to attempt to save invalid pojos. And I get a database error.

              • 4. Re: Exception: java.lang.IllegalArgumentException: could not

                Ok. So the validation is occuring. The @IfInvalid doesn't seem to be doing what I think it should. I can see in the stack trace that Hibernate knows it is invalid. But I get a stack trace instead of the page redisplayed.

                • 5. Re: Exception: java.lang.IllegalArgumentException: could not
                  gavin.king

                  What stacktrace?

                  • 6. Re: Exception: java.lang.IllegalArgumentException: could not

                    Well, I "fixed" it by putting jsf validators in the UI. But was hoping not to have to. Actually, I was thinking it would be nice to have the Hibernate Tool generate the annotations (like it does @Column) for basic things it can infer from the db schema.

                    Anyway, I am using the Hibernate tools to generate the basic crud app, so I am not sure if it is generating the correct code to make @IfInvalid work. The generated code looks some what different than the example code.

                    I took the jsf validator back out and reran. Below is the stack trace. I couldn't see anything helpful other than that the domain is being validated by the persistance mechanism.


                    2006-03-09 07:54:44,899 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seamapp].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
                    java.lang.IllegalStateException: Could not commit transaction
                    at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.commit(SeamExtendedManagedPersistencePhaseListener.java:83)
                    at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.afterPhase(SeamExtendedManagedPersistencePhaseListener.java:49)
                    at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersAfter(LifecycleImpl.java:536)
                    at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:318)
                    at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
                    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
                    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                    at java.lang.Thread.run(Thread.java:595)
                    Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=shsws0064/254, BranchQual=, localId=254] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.validator.InvalidStateException: validation failed for: com.shs.medai.RegionGroup)
                    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:369)
                    at org.jboss.tm.TxManager.commit(TxManager.java:239)
                    at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
                    at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.commit(SeamExtendedManagedPersistencePhaseListener.java:77)
                    ... 27 more
                    Caused by: org.hibernate.validator.InvalidStateException: validation failed for: com.shs.medai.RegionGroup
                    at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:104)
                    at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:132)
                    at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:209)
                    at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:64)
                    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
                    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
                    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
                    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
                    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
                    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
                    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
                    at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
                    at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1488)
                    at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1107)
                    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:321)
                    ... 30 more

                    • 7. Re: Exception: java.lang.IllegalArgumentException: could not
                      gavin.king

                      So two layers of validation occur here:

                      (1) UI validation, called when you have an action listener with @Invalid
                      (2) Database access validation, called before writing to the DB

                      (1) causes pretty faces messages
                      (2) causes stacktraces

                      You are seeing (2) happening here. You have not done any of (1).

                      • 8. Re: Exception: java.lang.IllegalArgumentException: could not

                        I understand what is supposed to happen. I'm not sure why (1) is not happening. I don't see a @Invalid annotation.


                        The action method being called is defined as

                         @IfInvalid(outcome = Outcome.REDISPLAY)
                         public String update() {
                         refreshFinder();
                         return null;
                         }
                        


                        And was generated by Hibernate Tools.

                        Like I said, I understand what is supposed to happen (both UI and DB validation) but not why UI validation is not happening.

                        Oddly, it seems to be working fine on the create method. Just not the update.

                        Below is the create method:

                         @Begin(join = true)
                         @IfInvalid(outcome = Outcome.REDISPLAY)
                         public String create() {
                         if (entityManager.find(RegionGroup.class, instance.getRegiongroupid()) != null) {
                         FacesContext.getCurrentInstance().addMessage(
                         null,
                         new FacesMessage(resourceBundle
                         .getString("RegionGroup_regiongroupid")
                         + " " + resourceBundle.getString("AlreadyExists")));
                         return null;
                         }
                         entityManager.persist(instance);
                         isNew = false;
                         refreshFinder();
                         return "editRegionGroup";
                         }


                        • 9. Re: Exception: java.lang.IllegalArgumentException: could not
                          gavin.king

                          Probably you need some @TransactionAttribute(NOT_SUPPORTED) annotations on some getter methods, to stop changes being flushed too early.