0

ComponentNotFoundException when loading media in iframe

asked 2009-03-28 22:33:00 +0800

etamas gravatar image etamas
78 2

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!

delete flag offensive retag edit

11 Replies

Sort by » oldest newest

answered 2009-03-28 23:15:31 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-03-28 23:15:53 +0800

Hi etamas,

please give us more information.
More code. How do you call the pdf. Which ZK version. What means sometimes.

link publish delete flag offensive edit

answered 2009-03-29 09:52:36 +0800

etamas gravatar image etamas
78 2

updated 2009-03-29 09:53:46 +0800

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.

link publish delete flag offensive edit

answered 2009-03-29 16:35:53 +0800

sreed gravatar image sreed
195 1 3 5

updated 2009-03-29 16:38:16 +0800

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?

link publish delete flag offensive edit

answered 2009-03-30 00:16:09 +0800

etamas gravatar image etamas
78 2

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);
}

}
*********************************

link publish delete flag offensive edit

answered 2009-03-30 00:20:50 +0800

etamas gravatar image etamas
78 2

updated 2009-03-30 00:49:18 +0800

I don´t see why the Exception occurs. Thanks again for your help.

link publish delete flag offensive edit

answered 2009-03-30 01:20:15 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

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?

link publish delete flag offensive edit

answered 2009-03-30 01:49:56 +0800

etamas gravatar image etamas
78 2

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.

link publish delete flag offensive edit

answered 2010-09-20 08:11:26 +0800

Kuldeep gravatar image Kuldeep
33

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.

link publish delete flag offensive edit

answered 2010-09-20 08:50:55 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-09-20 08:52:11 +0800

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)

link publish delete flag offensive edit

answered 2010-09-26 20:40:48 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

@stephan,

Would you post this to ZK bugs so we can track it? Thanks.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-03-28 22:33:00 +0800

Seen: 1,245 times

Last updated: Sep 27 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More