7 Replies Latest reply: Oct 8, 2013 12:42 AM by Maroof Ahmad RSS

    oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009

    Maroof Ahmad

      Hi,

       

      I am getting same error which so many times posted in this forum. But mine case is little different from others. I am using JDeveloper 12c

      I am uploading multiple files and committing in DB one by one. So Uploaded files as a List here. I am facing problem when Blob data setting in respective binding. I am trying to upload doc.txt file which have content kallan.

      Code Snippet:

         private List<UploadedFile> uploadedFile;

        List<UploadedFile> files = this.getUploadedFile();     

         for (int i = 0; i < files.size(); i++) {

      AttributeBinding atrBlobDocContent = (AttributeBinding)bindings.getControlBinding("DocContent");

        atrBlobDocContent.setInputValue(files.get(i));//Error getting here tried 1

      ///Below tried 2 

      blobFile = FileOperations.writeToBlobDomain(files.get(i));

                              atrBlobDocContent.setInputValue(blobFile);

       

      How can i set blob value from list in atrBlobDocContent binding.

       

      See below detailed code

       

      Bean Class

      public class FolderUploadBean {   

         

          public BindingContainer getBindings() {

              //return..

                      return BindingContext.getCurrent().getCurrentBindingsEntry();

                  }

              BindingContainer bindings = getBindings();

         

          private List<UploadedFile> uploadedFile;

          //private List<String> fileName;

          private BlobDomain blobFile;

       

       

          public void setBlobFile(BlobDomain blobFile) {

              this.blobFile = blobFile;

          }

       

       

          public BlobDomain getBlobFile() {

              return blobFile;

          }

       

       

          public FolderUploadBean() {

          }

       

       

       

       

       

          public void setUploadedFile(List<UploadedFile> uploadedFile) {

              this.uploadedFile = uploadedFile;

          }

       

       

          public List<UploadedFile> getUploadedFile() {

              return uploadedFile;

          }

       

       

       

       

          public String saveFiles() {

              List<UploadedFile> files = this.getUploadedFile();      

             System.out.println("Save Files Called");       

              if (files != null) {

                  System.out.println("\n File size == "+files.size());

                  for (int i = 0; i < files.size(); i++) {

                      System.out.println("\n File Name == "+files.get(i).getFilename());              

                      System.out.println("\n File length == "+files.get(i).getLength());

                      OperationBinding dmsBlobBinding = bindings.getOperationBinding("CreateInsert");

                      OperationBinding dmsInfoBinding = bindings.getOperationBinding("CreateInsert1");

                      //OperationBinding dmsApplMapBinding = bindings.getOperationBinding("CreateInsert2");

                      //-------------------

                      AttributeBinding atrBlobDocId = (AttributeBinding)bindings.getControlBinding("DocBlobId");

                      AttributeBinding atrBlobSeqNo = (AttributeBinding)bindings.getControlBinding("SeqNo");

                      AttributeBinding atrBlobDocContent = (AttributeBinding)bindings.getControlBinding("DocContent"); 

                      //Info Atribute Values      

                      AttributeBinding atrInfDocBlobId = (AttributeBinding)bindings.getControlBinding("DocBlobId1");

                      AttributeBinding atrInfoSeqNo = (AttributeBinding)bindings.getControlBinding("SeqNo1");

                      //AttributeBinding atrInfoDocType = (AttributeBinding)bindings.getControlBinding("DocType");

                      AttributeBinding atrInfoDocName = (AttributeBinding)bindings.getControlBinding("DocName");      

                      //Map Attrib Valuess

                     // AttributeBinding atrDMSMapDocBlobId = (AttributeBinding)bindings.getControlBinding("DocBlobId2");

                      dmsBlobBinding.execute();

                      dmsInfoBinding.execute();

                      //dmsApplMapBinding.execute();               

                      OperationBinding opBindingSeql = bindings.getOperationBinding("generateDocBlobId");

                      //Map paramsMap = opBindingSeql.getParamsMap();

                      String strFirstDocBlobId = opBindingSeql.execute().toString();

                     // System.out.println("returned seq from impl = "+strFirstDocBlobId); 

                      int intFirstSeqNumber =  Integer.parseInt(strFirstDocBlobId); 

                      atrBlobDocId.setInputValue(intFirstSeqNumber);

                      atrBlobSeqNo.setInputValue(0);

                      //----------------Blob Table-------------------------

                      //System.out.println("Value of lob=="+files);

                      files.set(i, uploadedFile.get(i));

                   //   BlobDomain blobDomain = createBlobDomain(files.get(i));

                      //System.out.println("blobDomain == "+blobDomain);

                      //  byte[] dataContent = blobDomain.getStorageByteArray();

                  

                  

                      //----------------Info Table-------------------------      

                      atrInfDocBlobId.setInputValue(intFirstSeqNumber);

                      atrInfoSeqNo.setInputValue(0);

                 

                      atrInfoDocName.setInputValue(files.get(i).getFilename());     

                      //--------------Map Table---------------------------   

                      // atrDMSMapDocBlobId.setInputValue(intFirstSeqNumber);  

                      int intgetBlob = Integer.parseInt( atrBlobDocId.getInputValue().toString());              

                      atrBlobDocId.setInputValue(intFirstSeqNumber);

                      atrInfDocBlobId.setInputValue(intFirstSeqNumber);          

                      try{

                          blobFile = FileOperations.writeToBlobDomain(files.get(i));

                              atrBlobDocContent.setInputValue(blobFile);

                          }catch(Exception e){

                                  e.printStackTrace();

                              }

                     

                      //Abvoe All values are set

                      try{

                      OperationBinding operationBinding = bindings.getOperationBinding("Commit");

                                 

                      operationBinding.execute();

                   

                      }catch(Exception ex){

                          ex.printStackTrace();

                      }

                  }

              }

              return null;

          }

      }

      FileOperation.java

      public class FileOperations {

        public static synchronized BlobDomain writeToBlobDomain(UploadedFile imageFile)

              throws SQLException, IOException {

            

              InputStream in = imageFile.getInputStream();

            

              BlobDomain blobDomain = new BlobDomain();

             

              OutputStream out = blobDomain.getBinaryOutputStream();

          

                  byte[] buffer = new byte[8192];

                  int bytesRead = 0;

            

                  while ((bytesRead = in.read(buffer, 0, 8192)) != -1) {

                      out.write(buffer, 0, bytesRead);

                  }

             

                  in.close();

            

       

       

              return blobDomain;

          }

      }

      Error Log

      oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.lang.Integer from type:oracle.jbo.domain.BlobDomain with value:Kallan

        at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding._postSetValue(FacesCtrlAttrsBinding.java:183)

        at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.setInputValue(FacesCtrlAttrsBinding.java:146)

        at com.almulla.dms.view.beans.FolderUploadBean.saveFiles(FolderUploadBean.java:109)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:601)

        at com.sun.el.parser.AstValue.invoke(AstValue.java:254)

        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)

        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

        at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)

        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

        at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)

        at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:107)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)

        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)

        at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:101)

        at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:123)

        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)

        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:1083)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:402)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:225)

        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)

        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)

        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)

        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)

        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)

        at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208)

        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:202)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:137)

        at java.security.AccessController.doPrivileged(Native Method)

        at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)

        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)

        at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)

        at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)

        at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:225)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333)

        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)

        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220)

        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)

        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)

        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)

        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)

        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)

        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

      Caused by: oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.lang.Integer from type:oracle.jbo.domain.BlobDomain with value:Kallan

        at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:933)

        at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:112)

        at oracle.jbo.server.AttributeDefImpl.convertToJava(AttributeDefImpl.java:2515)

        at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1090)

        at oracle.adf.model.binding.DCDataControl.setAttributeInRow(DCDataControl.java:2388)

        at oracle.adf.model.bc4j.DCJboDataControl.setAttributeInRow(DCJboDataControl.java:2884)

        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow(JUCtrlValueBinding.java:1175)

        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValueInRow(JUCtrlValueBinding.java:3010)

        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2985)

        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2948)

        at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.setInputValue(FacesCtrlAttrsBinding.java:145)

        ... 68 more

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

        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

        at java.lang.Integer.parseInt(Integer.java:492)

        at java.lang.Integer.<init>(Integer.java:677)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)

        at oracle.jbo.domain.TypeConvMapEntry.convert(TypeConvMapEntry.java:101)

        at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:883)

        ... 78 more

       

      Maroof

        • 1. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
          Timo Hahn

          Well, this too much code to digest

          What I see is that you you don't check after you execute an operation if there are any error. Try/catch will not work with operation bindings as all exceptions are catches internally. You have to look from them in the operation binding like

          if (!operation.getErrors().isEmpty())
          {
             // handle errors here errors is a list of exceptions!
          }

          Then you call an operation to get a sequence number via a method call. Why don't you set the sequence directly when you create a new row?

          Please structure the code in a way it's better digestible, e.g. reate the blobinfo row and set it's values before creating the blob data...

           

          By the way, does it work if you only use a single file?

           

          Timo

          • 2. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
            Maroof Ahmad

            Hi Timo,

            Actually i need a multiple file upload in blob. I am unable to set List blob data in blob attribute.

            Code Snippet:

               private List<UploadedFile> uploadedFile;

              List<UploadedFile> files = this.getUploadedFile();    

               for (int i = 0; i < files.size(); i++) {

            AttributeBinding atrBlobDocContent = (AttributeBinding)bindings.getControlBinding("DocContent");

              atrBlobDocContent.setInputValue(files.get(i));//Error getting here tried 1

            While Single file upload working fine. I think here some Blob iteration is wrong? please take look in blob iteration and leave rest code .

             

            Maroof

            • 3. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
              Timo Hahn

              Maroof, it's of no use just looking at a couple of lines of code. As long as the other problems can cause trouble, e.g. exceptions are not handled which would give you something to investigate, it doesn't make sense to go on.

              Meaning, you should first fix the shortcomings of your code before doing the next step. Only if you know that there are no exception you can be sure that the rest of the code might work.


              Have you used the debugger and stepped through the code?


               

              atrBlobDocContent.setInputValue(files.get(i));

               

              throws the error, so you should try to find out why. A best practise in this situation is to separate the statements to make sure the are correct and give you hte data you want. Doing this here gives you

              UploadedFile uf = files.get(i);

              atrBlobDocContent.setInputValue(uf);

              Now, is this what you want?



              Timo

              • 4. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
                Maroof Ahmad

                Hi Timo,

                 

                Actually i want folder's whole file upload. Inside selected folder whatever files is there i want upload all in folder selection or inside folder files selection.

                I am storing files as blob in DB. If any sample code is there, please let me know.

                 

                Maroof

                • 5. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
                  Maroof Ahmad

                  Hi Timo,

                   

                  I got below error how can i fix it.

                   

                  Cannot convert org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename@f0e626 of type class org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename to interface java.util.List

                   

                  Maroof

                  • 6. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
                    Timo Hahn

                    Maroof, come on, how should we know if we don't even know where you got the exception?


                    Timo

                    • 7. Re: oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: JBO-25009
                      Maroof Ahmad

                      Hi,

                       

                      This post related to my problem in my application have been resolved. Now for Data creation i am using below method .

                       

                      private BlobDomain createBlobDomain(UploadedFile file)

                           {

                               InputStream in = null;

                               BlobDomain blobDomain = null;

                               OutputStream out = null;

                               try

                               {

                                   in = file.getInputStream();

                                   blobDomain = new BlobDomain();

                                   out = blobDomain.getBinaryOutputStream();     

                                   IOUtils.copy(in, out);

                               }

                               catch (IOException e)

                               {

                                   e.printStackTrace();

                               }

                               catch (SQLException e)

                               {

                                   e.fillInStackTrace();

                               }

                               return blobDomain;

                           }

                       

                      and other issues like list file data setting to attribute binding below is correct .

                       

                      atrBlobDocContent.setInputValue( createBlobDomain(files.get(i)));

                       

                      In my case it was silly mistake in pageDefnitionBinding, Here  atrBlobDocContent attribute referencing  some long type with other VO.


                      Thanks to Timo Hahn for suggesting and helping in Debug.



                      Maroof