14 Replies Latest reply: May 12, 2010 2:07 PM by 761290 RSS

    IllegalArgumentException:An instance of a null PK has been incorrectly prov

    761290
      Jdeveloper 11G 11.1.1.1, WLS 10.3.1, Oracle DB 11G, Windows Vista

      java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation.

      It appears to be the query that is returning the error through the Session Bean.
      EodSBBean.getContainers(EodSBBean.java:739)

      The error shows every time I go to the page that is displaying the information from the session/entity 3.0 query.

      BUT... the information is actually displayed correctly. I cannot seem to find where this is seeing a null for the PK.

      This particular table has several foreign keys and also has a parent as well.

      How do I trace down the table that is causing the issue?

      Thanks in advanced for your help,
      Tracy
        • 1. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
          Jan Vervecken
          hi Tracy

          It could be useful if you can post a part of the stacktrace for the IllegalArgumentException you see (e.g. the first 10 lines starting with the java.lang.IllegalArgumentException).

          regards
          Jan
          • 2. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
            761290
            Here you go... Thanks for looking into it!

            Messages for this page are listed below.
            Unexpected exception caught: javax.ejb.EJBException, msg=EJB Exception: : java.lang.IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation.
            at org.eclipse.persistence.internal.jpa.EntityManagerImpl.findInternal(EntityManagerImpl.java:469)
            at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:428)
            at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:336)
            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:597)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:90)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:89)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:24)
            at $Proxy143.find(Unknown Source)
            at mil.af.aces.eod.ims.session.EodSBBean.getContainers(EodSBBean.java:739)
            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:597)
            at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
            at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
            at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
            at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
            at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
            at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
            at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy145.getContainers(Unknown Source)
            at mil.af.aces.eod.ims.session.EodSB_eup768_EodSBLocalImpl.getContainers(EodSB_eup768_EodSBLocalImpl.java:5420)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            • 3. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
              Jan Vervecken
              hi Tracy

              Maybe others reading this thread can do a suggestion based on the stacktrace you posted.

              (You write "... the information is actually displayed correctly ...", but could it be that your method "mil.af.aces.eod.ims.session.EodSBBean.getContainers()" is somehow called twice, where only the second time (different) input causes the IllegalArgumentException?)

              success
              Jan
              • 4. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                761290
                I am only making one call in the whole program, it is a brand new project and this is my first pages.

                I actually tried placing the table on the same page with the executable button and forwarding to another page and placing the table on it. Both return the same message.
                • 5. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                  Jan Vervecken
                  hi Tracy

                  Since this is "... a brand new project ..." you might be able to post some steps (coarse-grained or fine-grained) to reproduce your problem?

                  regards
                  Jan
                  • 6. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                    761290
                    First page...

                    two input fields and a submit button - executes the following session bean method


                    public List<Containers> getContainers(Long orgId, Long typeId) {
                    Organizations org = em.find(Organizations.class, orgId);
                    return getContainersFindByOrgAndTypeId(org, typeId);
                    }

                    The getContainers calls this method

                    public List<Containers> getContainersFindByOrgAndTypeId(Organizations org,
                    Long typeId) {
                    return em.createNamedQuery("Containers.findByOrgAndTypeId").setParameter("org", org).setParameter("typeId", typeId).getResultList();
                    }

                    Which in turn calls this entity's NamedQuery

                    @NamedQuery(name = "Containers.findByOrgAndTypeId", query = "select o from Containers o where o.organizations = :org AND o.typeId = :typeId")


                    Thanks!
                    • 7. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                      761290
                      The second page displays the table with the information from the query.
                      • 8. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                        761290
                        this same functionality worked in jdev version 11.1.1.3 but I had to back track to version 11.1.1.1 due to the wls upgrade that is packaged, per our networking team
                        • 9. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                          761290
                          i have three tables
                          organizations - parent table
                          containers - has foreign key to organization
                          equipment - has foreign key to container

                          The only way I knew to seach on the container table by a certain field and return the containers for that particular organization was to write the two methods mentioned in my last post.

                          If anyone has a better idea, please feel free to share. Like I said before, these methods worked in the latest version but I don't have a choice but to use jdev 11.1.1.1

                          Thanks,
                          Tracy
                          • 10. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                            759648
                            hi friend, ohh gigant problem !!
                            this is EJB?
                            joaquin
                            • 11. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                              761290
                              Yes, ejb 3.0. The methods are in my session bean, as I am sure that you guessed already.

                              Any guess at what could be going on with it behind the scenes?
                              • 12. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                                761290
                                I tried setting the Editing Mode to clickToEdit and a partial trigger to the command button. It still gives same error.

                                I also tried setting the Render to false. Thinking that it may have something with the page trying to load data for the table that had not yet been retrieved because the query had not been executed.

                                Any ideas. Please I'm desparate!
                                • 13. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                                  Jan Vervecken
                                  hi Tracy
                                  Any ideas. Please I'm desparate!
                                  You could create a service request on http://support.oracle.com .

                                  regards
                                  Jan
                                  • 14. Re: IllegalArgumentException:An instance of a null PK has been incorrectly prov
                                    761290
                                    Thanks so much for the link. Have a blessed afternoon!