Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsCannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221269/#msg_1221269
in order to integrate our RAP application into a production environment we needed to add a <filter> in the web.xml.
The filter make use of a third-party Jar which contains a class that has to be called from inside the RAP application.
We put this Jar into the application in the usual RCP way (plugin.xml, tab 'Runtime', Classpath section, Add.. and also checked it in build.properties for exporting).
When we deployed the application the first time we got an error about setting the filter; then we put the third-party Jar also into the WEB-INF/lib folder.
In this way the filter error does not show and the application starts.
The problem comes when the application calls the class from the Jar, where we get the following error:
'Cannot cast object from a.Class to a.Class'
It seems that having this double location for the jar may be the cause.
What is the correct way in this cases?
Thank you
Vincenzo]]>Vincenzo Caselli2013-12-17T09:18:31-00:00Re: Cannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221419/#msg_1221419
> Hi,
> in order to integrate our RAP application into a production environment
> we needed to add a <filter> in the web.xml.
> The filter make use of a third-party Jar which contains a class that has
> to be called from inside the RAP application.
> We put this Jar into the application in the usual RCP way (plugin.xml,
> tab 'Runtime', Classpath section, Add.. and also checked it in
> build.properties for exporting).
> When we deployed the application the first time we got an error about
> setting the filter; then we put the third-party Jar also into the WEB-INF/lib folder.
> In this way the filter error does not show and the application starts.
> The problem comes when the application calls the class from the Jar,
> where we get the following error:
> 'Cannot cast object from a.Class to a.Class'
> It seems that having this double location for the jar may be the cause.
> What is the correct way in this cases?
> Thank you
> Vincenzo
Hi Vincenzo,
You could try to use the filter extensionpoint in your plugin instead of
defining it in your web.xml.
Regards,
Markus]]>Markus rĂ¼ger2013-12-17T16:55:06-00:00Re: Cannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221440/#msg_1221440
this third party library is for automatic authentication (a sort of single-signon).
It comes with specific instructions on how to modify the web.xml, so, unless the filter extensionpoint does exactly the same thing of <filter> tag, we would try to stay with the standard J2EE way.
But maybe RAP can handle this.
In fact we saw that the .warproduct file (we followed your tutorial at http://eclipse.org/rap/developers-guide/devguide.php?topic=deployment.html&version=2.1), in the Configuration tab, has the Library section, which says "List all the libraries that go into the lib folder of the WAR file": well, it seems just what we need!
Pressing the Add button we selected the Jar from the plugin where we put at the beginning; once selected it shows in the Libraries section.
When exporting the WAR we see it exactly in the WEB-INF/lib!
Tomorrow I will try the deploy of this war and I'll let you know.
For now I would just be sure to have made the correct usage of the Libraries section in warproduct: in the end what we made was:
1) put the Jar into one of the application plugins in the usual RCP way
2) add it in the .warproduct file, so to have it into WEB-INF/lib when exported
is this the correct procedure?
Thank you very much
Vincenzo]]>Vincenzo Caselli2013-12-17T18:05:50-00:00Re: Cannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221702/#msg_1221702
To avoid lib duplication, and you need to have some libs in WEB-INF/lib of your legacy war,
you can configure servlet bridge to expose these libs in equinox runtime for the web application.
You can update launch.ini :
osgi.parentClassloader=app
osgi.contextClassLoaderParent=ccl
then with org.osgi.framework.system.packages.extra property, you can define which packages will be exported inside equinox runtime
you can import these packages in required bundle, lib define in WEB-INF lib will be used
Regards,
Arnaud
]]>Arnaud MERGEY2013-12-18T09:10:28-00:00Re: Cannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221739/#msg_1221739
thank you. Should we follow your suggestion in addition to the procedure I described (add it in the .warproduct file, section Libraries)?
TIA
Vincenzo]]>Vincenzo Caselli2013-12-18T10:36:08-00:00Re: Cannot cast from a.Class to a.Class
https://www.eclipse.org/forums/index.php/mv/msg/628648/1221863/#msg_1221863
I followed your suggestion after adding the jar to the .warproduct file in Libraries section(this latest step alone did not worked): it worked!!
You saved my day, thank you!!
Cheers
Vincenzo]]>Vincenzo Caselli2013-12-18T15:19:17-00:00