Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsXWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/535287/#msg_535287
Is this a known limitation or a bug?
public static void main (String [] args) {
try {
URL file = MyConfigData.class.getResource("/networkeditor/config/ui/MyConfigDialog.xwt ");
XWT.open(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
BTW, When I press the Preview button in the XWT file editor (in XWT perspective) the event handler is invoked correctly. So there is something that I am not doing correctly.
I tried passing parent composite so that ILoadingContext is set differently.
I exported the package containing these classes via MANIFEST.MF.
I changed Eclipse-BuddyPolicy: global (although it shouldn't help in theory)
I checked the Eclipse-BuddyPolicy in org.eclipse.e4.xwt and it is not set so I don't know how the xwt plugin loads these classes. I am using ver 0.9.1 from 2010 04 06.
XWT simply can't load the MyConfigDialog class.
Any help will be appreciated.
Thanks,
Swavek
]]>Swavek 2010-05-21T21:30:59-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/535820/#msg_535820
Composite configPanelsContainer = new Composite(container, SWT.NONE);
StackLayout stackLayout = new StackLayout();
configPanelsContainer.setLayout(stackLayout);
String configURLString = "/networkeditor/config/ui/MyConfigDialog.xwt";
URL configPanelURL = getClass().getClassLoader().getResource(configURLString);
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(configURLStr ing);
// load it
configPanel = XWT.load(configPanelsContainer, inputStream, configPanelURL, getDataContext());
However when I try to run my app after exporting from Eclipse environment the loading of the xwt file doesn't work . I get this exception:
!ENTRY com.infogix.dptoolcatalog 4 1 2010-05-25 14:31:36.552
!MESSAGE my error
!STACK 0
java.io.FileNotFoundException: /networkeditor/config/ui\MyConfigDialog.xwt
at org.eclipse.osgi.framework.internal.protocol.bundleresource. Handler.findBundleEntry(Handler.java:51)
at org.eclipse.osgi.framework.internal.core.BundleResourceHandl er.openConnection(BundleResourceHandler.java:175)
at java.net.URL.openConnection(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at org.eclipse.e4.xwt.internal.xml.DocumentRoot.openStream(Docu mentRoot.java:137)
at org.eclipse.e4.xwt.internal.xml.ElementManager.load(ElementM anager.java:252)
at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:643)
at org.eclipse.e4.xwt.XWTLoader.loadWithOptions(XWTLoader.java: 863)
at org.eclipse.e4.xwt.XWTLoader.load(XWTLoader.java:729)
at org.eclipse.e4.xwt.XWT.load(XWT.java:425)
at com.infogix.dptoolcatalog.export.configui.NodePropertiesDial og.getConfigPanelsMap(NodePropertiesDialog.java:289)
at com.infogix.dptoolcatalog.export.configui.NodePropertiesDial og.createDialogArea(NodePropertiesDialog.java:218)
at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java: 760)
....]]>Swavek 2010-05-25T19:42:01-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/535848/#msg_535848
Best regards
Yves YANG
"Swavek" <slorenc@infogix.com> wrote in message
news:hth96a$ukj$1@build.eclipse.org...
> After looking into how the new XWT designer performs class loading, I
> tried to load to specify the classloader that XWT should be using. Now it
> works when I run within Eclipse. I used an alternative load method which
> takes the parent component, input stream and url to load.
>
> Composite configPanelsContainer = new Composite(container, SWT.NONE);
> StackLayout stackLayout = new StackLayout();
> configPanelsContainer.setLayout(stackLayout);
>
> URL configPanelURL =
> getClass().getClassLoader().getResource(configURLString);
> InputStream inputStream =
> getClass().getClassLoader().getResourceAsStream(configURLStr ing);
>
> // load it configPanel = XWT.load(configPanelsContainer, inputStream,
> configPanelURL, getDataContext());
>
> However when I try to run my app after exporting from Eclipse environment
> the loading of the xwt file doesn't work . I get this exception:
>
> !ENTRY com.infogix.dptoolcatalog 4 1 2010-05-25 14:31:36.552
> !MESSAGE my error
> !STACK 0
> java.io.FileNotFoundException: /my/config\MyConfigPanel.xwt
> at org.eclipse.osgi.framework.internal.protocol.bundleresource.
> Handler.findBundleEntry(Handler.java:51)
> at org.eclipse.osgi.framework.internal.core.BundleResourceHandl
> er.openConnection(BundleResourceHandler.java:175)
> at java.net.URL.openConnection(Unknown Source)
> at java.net.URL.openStream(Unknown Source)
> at org.eclipse.e4.xwt.internal.xml.DocumentRoot.openStream(Docu
> mentRoot.java:137)
> at org.eclipse.e4.xwt.internal.xml.ElementManager.load(ElementM
> anager.java:252)
> at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:643)
> at org.eclipse.e4.xwt.XWTLoader.loadWithOptions(XWTLoader.java: 863)
> at org.eclipse.e4.xwt.XWTLoader.load(XWTLoader.java:729)
> at org.eclipse.e4.xwt.XWT.load(XWT.java:425)
> at com.infogix.dptoolcatalog.export.configui.NodePropertiesDial
> og.getConfigPanelsMap(NodePropertiesDialog.java:289)
> at com.infogix.dptoolcatalog.export.configui.NodePropertiesDial
> og.createDialogArea(NodePropertiesDialog.java:218)
> at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java: 760)
> ...]]>Yves YANG2010-05-26T01:21:15-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/536069/#msg_536069
I just downloaded the latest e4 M6 and verified that this problem goes away. Thank you. I was almost ready to give up on XWT.
Is setting of class loader still necessary for the XWT.load to succeed in loading x:Class? None of the examples are showing that this is necessary but I had to add a code like this to get the event handler class loaded. This class and the .xwt file are in the same package in the same plugin, but XWT has trouble loading it.
// override the class loader for the x:Class classes located within this plugin or else they will not be loaded
DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
loadingContext.setClassLoader(getClass().getClassLoader());
XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
.. then call XWT.load
Thanks,
Swavek
]]>Swavek 2010-05-26T20:49:13-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/576806/#msg_576806
I just downloaded the latest e4 M6 and verified that this problem goes away. Thank you. I was almost ready to give up on XWT.
Is setting of class loader still necessary for the XWT.load to succeed in loading x:Class? None of the examples are showing that this is necessary but I had to add a code like this to get the event handler class loaded. This class and the .xwt file are in the same package in the same plugin, but XWT has trouble loading it.
// override the class loader for the x:Class classes located within this plugin or else they will not be loaded
DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
loadingContext.setClassLoader(getClass().getClassLoader());
XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
.. then call XWT.load
Thanks,
Swavek]]>Swavek 2010-05-26T20:49:13-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/536896/#msg_536896
> loading x:Class? None of the examples are showing that this is necessary
> but I had to add a code like this to get the event handler class loaded.
> This class and the .xwt file are in the same package in the same plugin,
> but XWT has trouble loading it.
If your application is in plugin, the setting of class loader is always
necessary. It is not a problem of the implementation of XWT. It is a common
issue of OSGi.
Best regards
Yves YANG
"Swavek" <slorenc@infogix.com> wrote in message
news:htk1g7$aau$1@build.eclipse.org...
> Yves,
>
> I just downloaded the latest e4 M6 and verified that this problem goes
> away. Thank you. I was almost ready to give up on XWT.
>
> Is setting of class loader still necessary for the XWT.load to succeed in
> loading x:Class? None of the examples are showing that this is necessary
> but I had to add a code like this to get the event handler class loaded.
> This class and the .xwt file are in the same package in the same plugin,
> but XWT has trouble loading it.
>
> // override the class loader for the x:Class classes located within this
> plugin or else they will not be loaded
> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
> loadingContext.setClassLoader(getClass().getClassLoader());
> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>
> . then call XWT.load
>
> Thanks,
> Swavek
>]]>Yves YANG2010-05-31T12:45:52-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/576834/#msg_576834
> loading x:Class? None of the examples are showing that this is necessary
> but I had to add a code like this to get the event handler class loaded.
> This class and the .xwt file are in the same package in the same plugin,
> but XWT has trouble loading it.
If your application is in plugin, the setting of class loader is always
necessary. It is not a problem of the implementation of XWT. It is a common
issue of OSGi.
Best regards
Yves YANG
"Swavek" <slorenc@infogix.com> wrote in message
news:htk1g7$aau$1@build.eclipse.org...
> Yves,
>
> I just downloaded the latest e4 M6 and verified that this problem goes
> away. Thank you. I was almost ready to give up on XWT.
>
> Is setting of class loader still necessary for the XWT.load to succeed in
> loading x:Class? None of the examples are showing that this is necessary
> but I had to add a code like this to get the event handler class loaded.
> This class and the .xwt file are in the same package in the same plugin,
> but XWT has trouble loading it.
>
> // override the class loader for the x:Class classes located within this
> plugin or else they will not be loaded
> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
> loadingContext.setClassLoader(getClass().getClassLoader());
> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>
> . then call XWT.load
>
> Thanks,
> Swavek
>]]>Yves YANG2010-05-31T12:45:52-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/536906/#msg_536906
I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
Out of curiosity would it be possible instead of setting the class
loader to provide an OSGified load-Method.
XWT.load(Bundle bundle,String resource) this could make all relative
resources (Images, Classes, ...) relative to this bundle?
Tom
Am 31.05.10 14:45, schrieb Yves YANG:
>> Is setting of class loader still necessary for the XWT.load to succeed in
>> loading x:Class? None of the examples are showing that this is necessary
>> but I had to add a code like this to get the event handler class loaded.
>> This class and the .xwt file are in the same package in the same plugin,
>> but XWT has trouble loading it.
>
> If your application is in plugin, the setting of class loader is always
> necessary. It is not a problem of the implementation of XWT. It is a common
> issue of OSGi.
>
> Best regards
> Yves YANG
> "Swavek" <slorenc@infogix.com> wrote in message
> news:htk1g7$aau$1@build.eclipse.org...
>> Yves,
>>
>> I just downloaded the latest e4 M6 and verified that this problem goes
>> away. Thank you. I was almost ready to give up on XWT.
>>
>> Is setting of class loader still necessary for the XWT.load to succeed in
>> loading x:Class? None of the examples are showing that this is necessary
>> but I had to add a code like this to get the event handler class loaded.
>> This class and the .xwt file are in the same package in the same plugin,
>> but XWT has trouble loading it.
>>
>> // override the class loader for the x:Class classes located within this
>> plugin or else they will not be loaded
>> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
>> loadingContext.setClassLoader(getClass().getClassLoader());
>> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>>
>> . then call XWT.load
>>
>> Thanks,
>> Swavek
>>
>
>]]>Thomas Schindl2010-05-31T13:03:37-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/576845/#msg_576845
I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
Out of curiosity would it be possible instead of setting the class
loader to provide an OSGified load-Method.
XWT.load(Bundle bundle,String resource) this could make all relative
resources (Images, Classes, ...) relative to this bundle?
Tom
Am 31.05.10 14:45, schrieb Yves YANG:
>> Is setting of class loader still necessary for the XWT.load to succeed in
>> loading x:Class? None of the examples are showing that this is necessary
>> but I had to add a code like this to get the event handler class loaded.
>> This class and the .xwt file are in the same package in the same plugin,
>> but XWT has trouble loading it.
>
> If your application is in plugin, the setting of class loader is always
> necessary. It is not a problem of the implementation of XWT. It is a common
> issue of OSGi.
>
> Best regards
> Yves YANG
> "Swavek" <slorenc@infogix.com> wrote in message
> news:htk1g7$aau$1@build.eclipse.org...
>> Yves,
>>
>> I just downloaded the latest e4 M6 and verified that this problem goes
>> away. Thank you. I was almost ready to give up on XWT.
>>
>> Is setting of class loader still necessary for the XWT.load to succeed in
>> loading x:Class? None of the examples are showing that this is necessary
>> but I had to add a code like this to get the event handler class loaded.
>> This class and the .xwt file are in the same package in the same plugin,
>> but XWT has trouble loading it.
>>
>> // override the class loader for the x:Class classes located within this
>> plugin or else they will not be loaded
>> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
>> loadingContext.setClassLoader(getClass().getClassLoader());
>> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>>
>> . then call XWT.load
>>
>> Thanks,
>> Swavek
>>
>
>]]>Thomas Schindl2010-05-31T13:03:37-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/576874/#msg_576874
> I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
You are absolutely right. Thanks for correcting me.
> Out of curiosity would it be possible instead of setting the class
> loader to provide an OSGified load-Method.
>
> XWT.load(Bundle bundle,String resource) this could make all relative
> resources (Images, Classes, ...) relative to this bundle?
I think it should have the same result. The class loader can load resources
as well. We do use the classloader to load images, XWT files.
yves
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:hu0c3a$53n$1@build.eclipse.org...
> Hi Yves,
>
> I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
>
> Out of curiosity would it be possible instead of setting the class
> loader to provide an OSGified load-Method.
>
> XWT.load(Bundle bundle,String resource) this could make all relative
> resources (Images, Classes, ...) relative to this bundle?
>
> Tom
>
> Am 31.05.10 14:45, schrieb Yves YANG:
>>> Is setting of class loader still necessary for the XWT.load to succeed
>>> in
>>> loading x:Class? None of the examples are showing that this is
>>> necessary
>>> but I had to add a code like this to get the event handler class loaded.
>>> This class and the .xwt file are in the same package in the same plugin,
>>> but XWT has trouble loading it.
>>
>> If your application is in plugin, the setting of class loader is always
>> necessary. It is not a problem of the implementation of XWT. It is a
>> common
>> issue of OSGi.
>>
>> Best regards
>> Yves YANG
>> "Swavek" <slorenc@infogix.com> wrote in message
>> news:htk1g7$aau$1@build.eclipse.org...
>>> Yves,
>>>
>>> I just downloaded the latest e4 M6 and verified that this problem goes
>>> away. Thank you. I was almost ready to give up on XWT.
>>>
>>> Is setting of class loader still necessary for the XWT.load to succeed
>>> in
>>> loading x:Class? None of the examples are showing that this is
>>> necessary
>>> but I had to add a code like this to get the event handler class loaded.
>>> This class and the .xwt file are in the same package in the same plugin,
>>> but XWT has trouble loading it.
>>>
>>> // override the class loader for the x:Class classes located within this
>>> plugin or else they will not be loaded
>>> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
>>> loadingContext.setClassLoader(getClass().getClassLoader());
>>> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>>>
>>> . then call XWT.load
>>>
>>> Thanks,
>>> Swavek
>>>
>>
>>
>]]>Yves YANG2010-05-31T23:28:17-00:00Re: XWT fails to load x:Class class
https://www.eclipse.org/forums/index.php/mv/msg/168642/537017/#msg_537017
> I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
You are absolutely right. Thanks for correcting me.
> Out of curiosity would it be possible instead of setting the class
> loader to provide an OSGified load-Method.
>
> XWT.load(Bundle bundle,String resource) this could make all relative
> resources (Images, Classes, ...) relative to this bundle?
I think it should have the same result. The class loader can load resources
as well. We do use the classloader to load images, XWT files.
yves
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:hu0c3a$53n$1@build.eclipse.org...
> Hi Yves,
>
> I wouldn't call it an OSGi-Issue but an OSGi-Requirement :-)
>
> Out of curiosity would it be possible instead of setting the class
> loader to provide an OSGified load-Method.
>
> XWT.load(Bundle bundle,String resource) this could make all relative
> resources (Images, Classes, ...) relative to this bundle?
>
> Tom
>
> Am 31.05.10 14:45, schrieb Yves YANG:
>>> Is setting of class loader still necessary for the XWT.load to succeed
>>> in
>>> loading x:Class? None of the examples are showing that this is
>>> necessary
>>> but I had to add a code like this to get the event handler class loaded.
>>> This class and the .xwt file are in the same package in the same plugin,
>>> but XWT has trouble loading it.
>>
>> If your application is in plugin, the setting of class loader is always
>> necessary. It is not a problem of the implementation of XWT. It is a
>> common
>> issue of OSGi.
>>
>> Best regards
>> Yves YANG
>> "Swavek" <slorenc@infogix.com> wrote in message
>> news:htk1g7$aau$1@build.eclipse.org...
>>> Yves,
>>>
>>> I just downloaded the latest e4 M6 and verified that this problem goes
>>> away. Thank you. I was almost ready to give up on XWT.
>>>
>>> Is setting of class loader still necessary for the XWT.load to succeed
>>> in
>>> loading x:Class? None of the examples are showing that this is
>>> necessary
>>> but I had to add a code like this to get the event handler class loaded.
>>> This class and the .xwt file are in the same package in the same plugin,
>>> but XWT has trouble loading it.
>>>
>>> // override the class loader for the x:Class classes located within this
>>> plugin or else they will not be loaded
>>> DefaultLoadingContext loadingContext = new DefaultLoadingContext ();
>>> loadingContext.setClassLoader(getClass().getClassLoader());
>>> XWTLoaderManager.getActive().setLoadingContext(loadingContex t);
>>>
>>> . then call XWT.load
>>>
>>> Thanks,
>>> Swavek
>>>
>>
>>
>]]>Yves YANG2010-05-31T23:28:17-00:00