-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am using an iframe component in an overlapped window and sometimes I get a ComponentNotFoundException that tells me that it failed to load the media (in my case a pdf file) in the iframe. BUT at the same time the pdf file is loaded and shown without any problems! Did anyone had the same exception in this situation?
How can I avoid the exception? Or where can I catch it?
Errormessage:
SCHWERWIEGEND: Failed to load media, /view/gd7m/z_d7_52/2/mymediafile.pdf
>>org.zkoss.zk.ui.ComponentNotFoundException: Component not found: z_d7_52
>> at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:380)
>> at org.zkoss.zk.au.http.AuDynaMediar.process(AuDynaMediar.java:108)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:362)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>...
Thank you kindly for your help!
Hi etamas,
please give us more information.
More code. How do you call the pdf. Which ZK version. What means sometimes.
Hi terrytornado!
Thanks for your fast answer.
I am using zk package 3.6.0.
My Window "showPDF" that includes the Iframe has the following code in the onCreate method:
Ressource ressource = Util.getRessource();
Iframe iframe = new Iframe();
byte[] data = ressource.getData();
InputStream dataStream = null;
if(data==null) {
dataStream = ressource.getDataSteam();
}
String name = ressource.getName();
String format = ressource.getFormat();
String ctype = ressource.getCtype();
Media media = null;
Media media = null;
if(data!=null) {
media = new AMedia(name, format, ctype, data);
} else {
media = new AMedia(name, format, ctype, dataStream);
}
iframe.setContent(media);
iframe.setHeight("100%");
iframe.setWidth("100%");
iframe.setParent(this);
The class Ressource has the following attributes:
private String name;
private byte[] data;
private String format;
private String ctype;
private InputStream dataSteam;
Like you can see I have Ressources that stores two different types of pdf-files. Some are given as byte[] and some as InputStream. When the window showPDF is created one iframe is included and one pdf-file loaded. The exception does not occur when I load pdf-files that are given as byte[]. When I load the first pdf-file that is given as InputStream no exception occurs. But when loading another pdf-file that is given as InputStream (right after the first one) the exception occurs.
I think the ComponentNotFoundException is usually related to data binding, perhaps even a ZK bug. I suspect the problem is in the zul file. Could you post the zul code that uses showPDF?
sure, although i don´t know if it would help anything.
here is the zul file:
+++++++++++++++++++++++++++++++
<?page id="page_wblist" title="Wissensbasislisten" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="win_wblist" use="components.cWBList" sclass="wblistwin_overlapped" title="Liste der verwendeten SOPs" border="normal" height="634px" width="560px" mode="overlapped" closable="true" onClose="self.closeWindow()" left="5px" top="58px" >
<listbox id="lb_wbliste" sclass="wblistbox" use="components.cList_WBList" fixedLayout="false" height="99%" width="100%" rows="36" onSelect="win_wblist.setSelectedListItem(self)">
<listhead>
<listheader label="SOP Kurzname" width="110px" />
<listheader label="SOP Bezeichnung" width="450px" />
</listhead>
</listbox>
</window>
</zk>
*********************************
+++++++++++++++++++++++++++++++++
the class cList_WBList extends Listbox and implements AfterCompose:
public void afterCompose() {
List<Knowledgebase> wissensbasen = Util.getWissensbasen();
if (wissensbasen != null){
ListModel strset = new SimpleListModel(wissensbasen);
super.setModel(strset);
super.setItemRenderer(new ItemRendererWBList());
}
*********************************
+++++++++++++++++++++++++++++++
ItemRendererWBList has the render method:
public void render(final Listitem li, final Object data) {
new Listcell(((Knowledgebase) data).getName()).setParent(li);
new Listcell(((Knowledgebase) data).getLangname()).setParent(li);
li.addEventListener("onDoubleClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
Knowledgebase sop = (Knowledgebase) data;
InputStream inputStream = HlpStream.classloader_getInputStreamFromResource("/ressources/" + name);
cWBList win_wblist= (cWBList) Path.getComponent("//page_wblist/win_wblist");
Ressource res = new Ressource(name, format, ctype, inputStream, win_wblist);
Util.setRessource(res);
Include inc = new Include();
inc.setSrc("w_ressourceanzeige.zul");
cWissensbasis win_wb = (cWissensbasis) Path.getComponent("//page_wissensbasis/win_wb");
inc.setParent(win_wb);
}
});
}
*********************************
+++++++++++++++++++++++++++++++
w_ressourceanzeige.zul:
<zk>
<window id="win_ressourceanzeige" use="components.cRessourceAnzeige" sclass="overlappedwindow_pat" title="PDF Anzeige" mode="overlapped" width="50%" border="normal" closable="true" >
<!--
<iframe id="pdfframe" src="berichtAktuell.pdf" height="100%" width="100%" ></iframe>
-->
</window>
</zk>
*********************************
+++++++++++++++++++++++++++++++
public class cRessourceAnzeige extends Window {
public void onCreate() {
this.setShadow(false);
if(Util.isPatientenAnsicht()) {
this.setTop("94px");
this.setHeight("85.5%");
} else if(Util.isWissensbasisAnsicht()) {
this.setTop("58px");
this.setHeight("90%");
}
this.setLeft(ressource.getPosition());
Iframe iframe = new Iframe();
byte[] data = ressource.getData();
InputStream dataStream = null;
if(data==null) {
dataStream = ressource.getDataSteam();
}
String name = ressource.getName();
String format = ressource.getFormat();
String ctype = ressource.getCtype();
Media media = null;
if(data!=null) {
media = new AMedia(name, format, ctype, data);
} else {
media = new AMedia(name, format, ctype, dataStream);
}
iframe.setContent(media);
iframe.setContent(media);
iframe.setHeight("100%");
iframe.setWidth("100%");
iframe.setParent(this);
}
}
*********************************
I don´t see why the Exception occurs. Thanks again for your help.
this is zk bug cause of a un-expect request from browser(in IE mostly).
I think it was fixed in last version, I am not sure.
what is the zk version you have?
i use zk package 3.6.0 and the exception occurs with firefox and ie.
one time it is the exception mentioned above and the other time:
30.03.2009 03:45:38 org.zkoss.zk.au.http.AuDynaMediar process:130
SCHWERWIEGEND: Failed to load media, /view/gpf31/z_pf_v1/2/RE_Rhesus_Reminderfrage.pdf
>>org.zkoss.zk.ui.ComponentNotFoundException: Component not found: z_pf_v1
>> at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:380)
>> at org.zkoss.zk.au.http.AuDynaMediar.process(AuDynaMediar.java:108)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:362)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>...
i didn´t figure out why the exceptions happen or why they alternate.
I am also getting the same error on ZK 5.0.4 on Mozilla Firefox(version 3.6.3).
Error Log:
20-Sep-2010 18:37:21 org.zkoss.zk.au.http.AuDynaMediar service:139
SEVERE: Failed to load media, /view/zd_8hd/z_d__uc/1/test.htm
>>org.zkoss.zk.ui.ComponentNotFoundException: Component not found: z_d__uc
>> at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:458)
>> at org.zkoss.zk.au.http.AuDynaMediar.service(AuDynaMediar.java:117)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:430)
>> at com.tcs.sgv.zk.controller.BaseDHtmlUpdateServlet.doGet(BaseDHtmlUpdateServlet.java:22)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>> at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
>>...
Please Help.
This error i have over all zk versions. In my case it comes not at all times. Mostly if i closes the report to fast after opening.
It's thrown by closing a window with an iFrame which shows a report with AMedia.
In my case it has no effect to the correct working of the application but it's not nice.
20.09.2010 15:41:40 org.zkoss.zk.au.http.AuDynaMediar service:139 SCHWERWIEGEND: Failed to load media, /view/zd_8co/z_8co_ca/1/FirstReport.pdf >>org.zkoss.zk.ui.ComponentNotFoundException: Component not found: z_8co_ca >> at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:462) >> at org.zkoss.zk.au.http.AuDynaMediar.service(AuDynaMediar.java:117) >> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:430) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
Asked: 2009-03-28 22:33:00 +0800
Seen: 1,245 times
Last updated: Sep 27 '10