Skip to main content

java.lang.IllegalStateException: ADF_FACES-60003:Component with ID not registered for Active Data

This was hard to fix: if anyone wants the code just ask. Or if you have a better solution please post comment.

Once excel export has been clicked if we navigate around using ppr to refresh the region we get this error.

I was forced to create an export handler tag wich forces the export to happen in a new window.

Because this page is getting some hits here is some of the code (also use this method for pdf export):
Button with new listener: (xmlns:new="http://za.co.company/adf/faces/common/my" in your jsp:root)
<af:commandToolbarButton text="Export" id="ctb1" immediate="true" partialSubmit="true" icon="images/excel.jpg">
    <new:myExportCollectionActionListener exportedId="audTab" type="excelHTML" filename="audit.xls" title="Audit"/>
  </af:commandToolbarButton>

TAG:
import oracle.adfinternal.view.faces.export.ExportCollectionActionListener;
import oracle.adfinternal.view.faces.taglib.listener.ExportCollectionActionListenerTag;

public class MyExportCollectionActionListenerTag extends ExportCollectionActionListenerTag{


protected ActionListener createActionListener(){
  ExportCollectionActionListener exportListener = 
    (ExportCollectionActionListener) super.createActionListener();
  MyExportCollectionActionListener listener = new 
    MyExportCollectionActionListener(exportListener);
  return listener;
}

  protected String getTagName(){
    return "myExportCollectionActionListener";
  }
}
Actual work:

public class MyExportCollectionActionListener extends 
  ExportCollectionActionListener{

public void processAction(ActionEvent event){
 //stuff
  String exportedId = getExportedId();
  UIComponent exported = (exportedId == null) ? null : 
    event.getComponent().findComponent(exportedId);
  //stuff
   exporter = new TableExcelExporter();
   File outputFile = getTempFile(filename);
   FileOutputStream os = new FileOutputStream(outputFile);
   OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outputFile));
   if (exporter instanceof PdfExporter){
   ((PdfExporter)exporter).exportPdf(context, os, collection, getTitle(), 
      exportedRowsType);
   } else {
     exporter.export(context, writer, collection, getTitle(), exportedRowsType);
   }
   StreamUtil.closeStreamGracefully(os);
   writer.close();
   String generatedFileNameParam = URLEncoder.encode(outputFile.getAbsolutePath(), "UTF-8");
   HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
   ExtendedRenderKitService erks =    
     Service.getRenderKitService(FacesContext.getCurrentInstance(),    
     ExtendedRenderKitService.class);
   StringBuilder script = new StringBuilder();
   script.append("window.open('")
    .append(request.getContextPath())
    .append("/export?exportedId=")
    .append(exported).append("&type=")
    .append(contentType).append("&filename=").append(filename)
    .append("&gfn=").append(generatedFileNameParam).append("');");
   erks.addScript(FacesContext.getCurrentInstance(), script.toString());
}


Other:
In the meta-inf dir create your tld, taglib.xml and delaritivecomp-metadata.xml.

Create an export servlet to render the output from the temp file.

Comments

  1. Hi,

    I am having a simmilar problem but when using af:fileDownloadActionListener contentType="application/x-download"
    method="#{Bean.myMethod}" filename="filename"

    where myMethod puts on the response output the content of a file(xml).

    When pressing the button a normal popup window for saving(download) a file pops up. After download, when trying to refresh the region the folowing error apears:java.lang.IllegalStateException: ADF_FACES-60003:Component with ID: pt1:r1:1:pc1:cmi1 not registered for Active Data.
    Do you think that this is the same problem as yours? I don't understand how could I make the download happened in a new window(currently the download happens in the popup window, or not?).

    Regards Corneliu

    ReplyDelete
  2. Hi,

    This is definitely the same issue, we had the same problem with the fileDownloadActionListener.


    What we did to fix this was extend our download listener to include text files, pdf and excel etc.

    Also you could just map your button to a backing bean action that will generate the file in question then invoke a window.open javascript method (see above post) that will invoke a download.

    ReplyDelete
  3. Hi,
    Thanks for your answer.

    The file that I am downloading does not exist phisicaly. I create it programaticaly(as string) and then I write it on response with outputStream.write(); Do you think that I can apply your approach on this case also?
    If yes how will the window.open('??') java script look for download a file?
    Another question is that using the java script window.open in my backing bean will be enough, or I will have to implement my own filedownloadactionlistener?
    Regards Corneliu

    ReplyDelete
  4. You don’t need to create a filedownloadactionlistener. But unfortunately I cant think of an easy way to do this but here are some options:

    1) Create a servlet to stream the file
    window.open(“/exportServlet?info=”);

    add the servlet to web.xml


    export
    yourPackage.ExportServlet

    export
    /export


    Servlet will set the header and content type then stream the output
    response.setHeader("Content-Disposition", "attachment;filename=" + filename);
    response.setContentType(“application/x-download”);
    outputStream = response.getOutputStream();
    //write stuff to outputstream here

    2) Create a new page to do the stream and include the method in the page.
    window.open(“/newPage.jspx?info=”);

    ReplyDelete
  5. Hi,

    Can you please send me the code(with myExportCollectionActionListener or if you have one with filedownload will be better), maybe seeing an entire project I will understand better how can I implement it.
    You can find my mail in the profile.
    Regards Corneliu

    ReplyDelete
  6. Hi,

    I have the same problem. Can you send me the entire project to understand better the solution?
    Regards

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. java.lang.IllegalStateException

    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1
    I got this problem can you help me to solve it, Please??

    ReplyDelete
  9. No problem, unfortunately what you posted is only the top of the stack trace and I would need to see the full stack trace to help. If you could post it I will try to help.

    ReplyDelete

Post a Comment

Popular posts from this blog

ADF Encountered deferred syntax #{ in template text.

OracleJSP error: oracle.jsp.parse.JspParseException:  Error: Encountered deferred syntax #{ in template text.  If intended as a literal, escape it or set directive  deferredSyntaxAllowedAsLiteral This normally happens when you have some tag lib dependancy problems but this was  not the case for me... My problem: For some reason my model project had web stuff in it(public html etc)  so I had to remove the public html stuff from my project and manually edit the Model.jpr project file and remove the tag lib entries at the bottom o the file. Go figure.    

JBO-25013: TooManyObjectsException

oracle.jbo.TooManyObjectsException: JBO-25013: Too many objects match the primary key oracle.jbo.Key[Key null ]. Ok so for you it may be trying to insert a duplicate record this should explain your problem (also check trigger they could be the cause.) NOTE: You can also try to create a new duplicate EO if you have a page with two VO's using the same EO. This could sort your problems. For me I needed to add a launch listener on my LOV and clear the cache of my vo. LOV <af:inputListOfValues id="NameId" popupTitle="#{bindings.Name.hints.label}" value="#{bindings.RolName1.inputValue}" label="#{bindings.RolName1.hints.label}" model="#{bindings.RolName1.listOfValuesModel}" required="#{bindings.RolName1.hints.mandatory}" columns="#{bindings.RolName1.hints.displayWidth}" shortDesc="#{bindings.RolName1.hints.tooltip}" launchPopupListener="#{backingBeanScope.backingBean.launchPop

OJDeploy: Documentation for the tool

Real DOCS:  http://docs.oracle.com/cd/E26098_01/user.1112/e17455/deploying_apps.htm#OJDUG645 OJDeploy Documentation if you run it from the command line - I keep looking for this so I though I would post it here so I remeber. Oracle JDeveloper Deploy 11.1.2.1.0.6081 Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. Usage:   ojdeploy -profile <name> -workspace <jws> [ -project <name> ] [ <options> ]   ojdeploy -buildfile <ojbuild.xml> [ <options> ]   ojdeploy -buildfileschema Arguments:   -profile               the name of the Profile to deploy   -workspace      full path to the JDeveloper Workspace file(.jws)   -project              name of the JDeveloper Project within the .jws where the Profile can be found. If omitted, the Profile is assumed to be in the Workspace.   -buildfile            full path to a build file for batch deploy   -buildfileschema  print XML Schema for the build file