Re: wicket osgi (not Pax)
Hi, I have multiple Wicket Applications running on different servers, each of them runs on OSGI/Jetty, and a Master Wicket Application also runs on OSGI/Jetty. Master wicket application, has its own server, where it gets the data from the sub servers. Do you recommend Pax Wicket for such architechture? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-osgi-not-Pax-tp1893713p2991185.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
If you're already using Wicket successfully in OSGi, then I don't see what benefit using pax-wicket will add for you. pax-wicket is useful to help get you going in OSGi, since the class loading / serialization stuff can be tricky. Sounds like you're doing ok, though. =David On Oct 12, 2010, at 3:09 PM, kugaprakash wrote: Hi, I have multiple Wicket Applications running on different servers, each of them runs on OSGI/Jetty, and a Master Wicket Application also runs on OSGI/Jetty. Master wicket application, has its own server, where it gets the data from the sub servers. Do you recommend Pax Wicket for such architechture? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-osgi-not-Pax-tp1893713p2991185.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
In any case, this is getting REALLY off topic... ;-) On the contrary; this is really helpful for OSGi n00bs like me. Thanks for replying everyone. Eelco - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Hi David, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. There I just create the extensions points I need to allow extending components at some places (e.g. toolbars). The projects I mentioned are not a framework: just the skeleton showing how to encapsulate Wicket into a bundle and how to create an application depending on that bundle. What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Best regards, Ernesto On Thu, Jan 28, 2010 at 8:06 AM, David Leangen wic...@leangen.net wrote: I have seen OSGi successfully used with Wicket on production environments... With no problems with the serialization issues you mentioned. Yes, I am using pax-wicket for this. What I meant was--as I understood from the original post--the person wanted to use wicket in OSGi without using a framework. If that is the case, it is a huge headache. How does Antilla solve the problem? Do they have an elegant solution? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Hi Ernesto, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. Ok, do you mean buddy classloading? If so, that's not real OSGi. :-) What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Personally, I'm addicted to OSGi. I wish that somebody would come up with a good solution for this that doesn't rely on buddy classloading... Anyway, thanks for the discussion. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Yes I mean buddy class-loading. It might not be real OSGi but it works:-) as far as you only use equinox. I also do like a lot OSGi. But I know from experience that it might take some time for newbies to get the full grasp of it Cheers, Ernesto On Thu, Jan 28, 2010 at 9:47 AM, David Leangen wic...@leangen.net wrote: Hi Ernesto, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. Ok, do you mean buddy classloading? If so, that's not real OSGi. :-) What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Personally, I'm addicted to OSGi. I wish that somebody would come up with a good solution for this that doesn't rely on buddy classloading... Anyway, thanks for the discussion. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Buddy-class loading is real OSGi since 4.1 ;) The new MANIFEST.MF entry is named Bundle- *BuddyPolicy.* Cheers, Jochen On Thu, Jan 28, 2010 at 9:55 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Yes I mean buddy class-loading. It might not be real OSGi but it works:-) as far as you only use equinox. I also do like a lot OSGi. But I know from experience that it might take some time for newbies to get the full grasp of it Cheers, Ernesto On Thu, Jan 28, 2010 at 9:47 AM, David Leangen wic...@leangen.net wrote: Hi Ernesto, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. Ok, do you mean buddy classloading? If so, that's not real OSGi. :-) What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Personally, I'm addicted to OSGi. I wish that somebody would come up with a good solution for this that doesn't rely on buddy classloading... Anyway, thanks for the discussion. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Buddy-class loading is real OSGi since 4.1 ;) The new MANIFEST.MF entry is named Bundle- *BuddyPolicy.* Ok, thanks for letting me know. I haven't looked at 4.1 at all. I'll have to look into the buddy thing. I'm wondering if it was some kind of compromise for the Equinox people, or if there was some other real use-case. In any case, this is getting REALLY off topic... ;-) Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
I ran into a lot of use-cases for it. Just take a look at esper and drools. They are packaged as OSGi and need to be able to work with classes provided by people using them. But yes, we are getting a little off topic here :D
Re: wicket osgi (not Pax)
I did not know about it being included on the standard... Thanks for the update. Ernesto On Thu, Jan 28, 2010 at 11:18 AM, Jochen Mader pflanzenmoer...@gmail.comwrote: Buddy-class loading is real OSGi since 4.1 ;) The new MANIFEST.MF entry is named Bundle- *BuddyPolicy.* Cheers, Jochen On Thu, Jan 28, 2010 at 9:55 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Yes I mean buddy class-loading. It might not be real OSGi but it works:-) as far as you only use equinox. I also do like a lot OSGi. But I know from experience that it might take some time for newbies to get the full grasp of it Cheers, Ernesto On Thu, Jan 28, 2010 at 9:47 AM, David Leangen wic...@leangen.net wrote: Hi Ernesto, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. Ok, do you mean buddy classloading? If so, that's not real OSGi. :-) What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Personally, I'm addicted to OSGi. I wish that somebody would come up with a good solution for this that doesn't rely on buddy classloading... Anyway, thanks for the discussion. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Thank you very much On Thu, Jan 28, 2010 at 12:08 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: I did not know about it being included on the standard... Thanks for the update. Ernesto On Thu, Jan 28, 2010 at 11:18 AM, Jochen Mader pflanzenmoer...@gmail.com wrote: Buddy-class loading is real OSGi since 4.1 ;) The new MANIFEST.MF entry is named Bundle- *BuddyPolicy.* Cheers, Jochen On Thu, Jan 28, 2010 at 9:55 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Yes I mean buddy class-loading. It might not be real OSGi but it works:-) as far as you only use equinox. I also do like a lot OSGi. But I know from experience that it might take some time for newbies to get the full grasp of it Cheers, Ernesto On Thu, Jan 28, 2010 at 9:47 AM, David Leangen wic...@leangen.net wrote: Hi Ernesto, Antilia simply use equinox extensions for class-loading that way you can use normal Wicket components... No need to modify Wicket or your components. Ok, do you mean buddy classloading? If so, that's not real OSGi. :-) What I wanted to says is that you not always have to face the problems you mentioned: it might depend on how you build your application. But I do agree the OSGi road is not for the faint hearted and people should carefully consider their requirements before jumping into it: moreover if you can achieve extensibility and modularity with other means. Personally, I'm addicted to OSGi. I wish that somebody would come up with a good solution for this that doesn't rely on buddy classloading... Anyway, thanks for the discussion. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Is there a How-to for OSGI and wicket, not from pax I managed to install jetty servlet api in equinox...now I have to install wicket somehow Good luck! Due to serialization issues, it's not an easy problem to solve. I don't know of any how-to. All I can say is that you have a long road ahead of you. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Is there a How-to for OSGI and wicket, not from pax I managed to install jetty servlet api in equinox...now I have to install wicket somehow Good luck! Due to serialization issues, it's not an easy problem to solve. I don't know of any how-to. All I can say is that you have a long road ahead of you. Really? That's disappointing. I thought introducing IClassResolver way back when and asking OSGi people to work with that did the trick? How come it doesn't? Cheers, Eelco - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Hi Eelco, Is there a How-to for OSGI and wicket, not from pax I managed to install jetty servlet api in equinox...now I have to install wicket somehow Good luck! Due to serialization issues, it's not an easy problem to solve. I don't know of any how-to. All I can say is that you have a long road ahead of you. Really? That's disappointing. I thought introducing IClassResolver way back when and asking OSGi people to work with that did the trick? How come it doesn't? The IClassResolver does indeed make it possible, but not necessarily easy. OSGi (or at least proper use thereof) is very strict in terms of which packages can be seen by which other packages. In many cases, the actual classes that are serialized are dependencies of dependencies of depen... you get the idea. The problem that nobody appears to have take the time to solve in a satisfactory way is that upon deserialization, the actual classes being deserialized are not visible to the bundle that is doing the deserialization, so a CNFE is thrown. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
I have seen OSGi successfully used with Wicket on production environments... With no problems with the serialization issues you mentioned. Best, Ernesto On Thu, Jan 28, 2010 at 1:08 AM, David Leangen wic...@leangen.net wrote: Is there a How-to for OSGI and wicket, not from pax I managed to install jetty servlet api in equinox...now I have to install wicket somehow Good luck! Due to serialization issues, it's not an easy problem to solve. I don't know of any how-to. All I can say is that you have a long road ahead of you. Cheers, =David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket osgi (not Pax)
Take a look at http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter.demo http://code.google.com/p/antilia/source/browse/#svn/com.antilia.wstarter.demo Best, Ernesto On Wed, Jan 27, 2010 at 11:31 PM, Jan Juno janko...@gmail.com wrote: Is there a How-to for OSGI and wicket, not from pax I managed to install jetty servlet api in equinox...now I have to install wicket somehow
Re: wicket osgi (not Pax)
I have seen OSGi successfully used with Wicket on production environments... With no problems with the serialization issues you mentioned. Yes, I am using pax-wicket for this. What I meant was--as I understood from the original post--the person wanted to use wicket in OSGi without using a framework. If that is the case, it is a huge headache. How does Antilla solve the problem? Do they have an elegant solution? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket + OSGI + Session
Hi, Thank you for your suggestion. I have no time to look at this earlier, but Wicket 1.3.0-rc2 is out now and after upgrade the error message I have has changed to: java.lang.IllegalStateException: spring application context locator returned null at org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:180) at org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412) at org.apache.wicket.proxy.$Proxy82.getAction(Unknown Source) So it seems there is a problem with deserialization of spring application context locator. I have used my own locator implementation (OsgiSpringContextLocator). There is one locator created for each application context and there was a map of locators and app contexts. Locator reference was the key in this map (very, very bad thing :)): private static MapOsgiSpringContextLocator, ApplicationContext applicationContexts = new HashMapOsgiSpringContextLocator, ApplicationContext(); I have changed this now to: public class OsgiSpringContextLocator implements ISpringContextLocator { private static MapInteger, ApplicationContext applicationContexts = new HashMapInteger, ApplicationContext(); private static int appContextCounter = 0; private Integer appContextId; OsgiSpringContextLocator(ApplicationContext applicationContext) { appContextCounter++; appContextId = new Integer(appContextCounter); applicationContexts.put(appContextId, applicationContext); } public ApplicationContext getSpringContext() { ApplicationContext result = applicationContexts.get(appContextId); return result; } } So each appCtxt has its own unique index (appContextId) which is stored in locator, so locator is able to find a proper appCtxt by this id (even after deserialization) This is a quick fix that works, maybe in the future I will implement this in a more elegant way ;). Daniel On Nov 26, 2007 3:33 PM, Sebastiaan van Erk [EMAIL PROTECTED] wrote: Yep, I've seen though before. It's probably a ClassNotFoundException on deserialization which gets eaten by ObjectInputStream (there's a bug report at Sun for this). To be sure you can debug trapping on ClassNotFoundException (caught and uncaught) when this problem occurs. However, since it's in a page you can easily fix this one: either upgrade to trunk and implement your own IClassResolver and register it with the application, or write your own IObjectStreamFactory implementation and register it with the Objects class. In either case, have a look at the DefaultObjectStreamFactory to see how to write a hook to look up classes in an ObjectInputStream implementation (resolveClass method). Regards, Sebastiaan Daniel Stoch wrote: Hi, You have written: This causes problems with session serialization/deserialization in an OSGI environment. I don't know is it a related problem, but I have the following situation (of course app is running in OSGi environment): I have a page with DataView displaying products list with images. Each product has AjaxLink, when I click this link product should be selected (highlighted). But sometimes after click I have an error with serialization: Root cause: java.io.StreamCorruptedException: invalid type code: 01 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket + OSGI + Session
Hi, You have written: This causes problems with session serialization/deserialization in an OSGI environment. I don't know is it a related problem, but I have the following situation (of course app is running in OSGi environment): I have a page with DataView displaying products list with images. Each product has AjaxLink, when I click this link product should be selected (highlighted). But sometimes after click I have an error with serialization: Root cause: java.io.StreamCorruptedException: invalid type code: 01 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:392) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:121) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) Complete stack: java.lang.RuntimeException: Could not deserialize object using `org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory` object factory at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:406) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) Do you have similar problems with serialization/deserialization? PS. The strange thing is that in Firefox this is an undeterministic error but in Opera it occurs every time I've clicked the link. Best regards, Daniel On Nov 21, 2007 10:39 AM, Sebastiaan van Erk [EMAIL PROTECTED] wrote: Hi, When Wicket pages are serialized/deserialized to the page store, they are serialized/deserialized using the IObjectStreamFactory set in the Objects class, and (in trunk) the DefaultObjectStreamFactory overrides the resolveClass method of ObjectInputStream to consult the application's IClassResolver. This is all good. :-) But, the problem is the session itself. The ObjectIn/OutputStreams that the session is serialized to and deserialized from are the ones provided by the container, which do not use the IObjectStreamFactory. This causes problems with session serialization/deserialization in an OSGI environment. I'm not really deeply into the Wicket code, but it seems to me the only way to really solve this is to make sure the Wicket session is not directly put in the HTTP session, but instead of it, a SessionHolder object with a reference to the Wicket session. The SessionHolder can have readObject/writeObject methods which just read/write the session as a byte stream using Objects.byteArrayToObject/objectToByteArray. That way, when the Session is deserialized the IClassResolver is consulted (and if the user provides their own IObjectStreamFactory implementation, it too is used). Any comments? Regards, Sebastiaan - To unsubscribe, e-mail: [EMAIL
Re: Wicket + OSGI + Session
Yep, I've seen though before. It's probably a ClassNotFoundException on deserialization which gets eaten by ObjectInputStream (there's a bug report at Sun for this). To be sure you can debug trapping on ClassNotFoundException (caught and uncaught) when this problem occurs. However, since it's in a page you can easily fix this one: either upgrade to trunk and implement your own IClassResolver and register it with the application, or write your own IObjectStreamFactory implementation and register it with the Objects class. In either case, have a look at the DefaultObjectStreamFactory to see how to write a hook to look up classes in an ObjectInputStream implementation (resolveClass method). Regards, Sebastiaan Daniel Stoch wrote: Hi, You have written: This causes problems with session serialization/deserialization in an OSGI environment. I don't know is it a related problem, but I have the following situation (of course app is running in OSGi environment): I have a page with DataView displaying products list with images. Each product has AjaxLink, when I click this link product should be selected (highlighted). But sometimes after click I have an error with serialization: Root cause: java.io.StreamCorruptedException: invalid type code: 01 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:392) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:121) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) Complete stack: java.lang.RuntimeException: Could not deserialize object using `org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory` object factory at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:406) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) Do you have similar problems with serialization/deserialization? PS. The strange thing is that in Firefox this is an undeterministic error but in Opera it occurs every time I've clicked the link. Best regards, Daniel On Nov 21, 2007 10:39 AM, Sebastiaan van Erk [EMAIL PROTECTED] wrote: Hi, When Wicket pages are serialized/deserialized to the page store, they are serialized/deserialized using the IObjectStreamFactory set in the Objects class, and (in trunk) the DefaultObjectStreamFactory overrides the resolveClass method of ObjectInputStream to consult the application's IClassResolver. This is all good. :-) But, the problem is the session itself. The ObjectIn/OutputStreams that the session is serialized to and deserialized from are the ones provided by the container, which do not use the IObjectStreamFactory. This causes problems with session serialization/deserialization in an OSGI
Re: Wicket + OSGI + Session
Digging some more in the code, it seems to be the case that *pages* in the session are serialized like you say (writeObject in the Page class). However, this still leaves all the other objects in the session serialized by the container. Thus if I extend WebSession and add my own fields, they will be serialized/deserialized by the container and bypass IObjectStreamFactory. This is a problem if you store objects with classes from different OSGI bundles in your session. Regards, Sebastiaan Johan Compagner wrote: i though matej did already do something like that, because i think matej did try to avoid double serialization (by us and by the container) So i would say that it would go automatic already Isn't this the case matej? johan On Nov 21, 2007 10:39 AM, Sebastiaan van Erk [EMAIL PROTECTED] wrote: Hi, When Wicket pages are serialized/deserialized to the page store, they are serialized/deserialized using the IObjectStreamFactory set in the Objects class, and (in trunk) the DefaultObjectStreamFactory overrides the resolveClass method of ObjectInputStream to consult the application's IClassResolver. This is all good. :-) But, the problem is the session itself. The ObjectIn/OutputStreams that the session is serialized to and deserialized from are the ones provided by the container, which do not use the IObjectStreamFactory. This causes problems with session serialization/deserialization in an OSGI environment. I'm not really deeply into the Wicket code, but it seems to me the only way to really solve this is to make sure the Wicket session is not directly put in the HTTP session, but instead of it, a SessionHolder object with a reference to the Wicket session. The SessionHolder can have readObject/writeObject methods which just read/write the session as a byte stream using Objects.byteArrayToObject/objectToByteArray. That way, when the Session is deserialized the IClassResolver is consulted (and if the user provides their own IObjectStreamFactory implementation, it too is used). Any comments? Regards, Sebastiaan smime.p7s Description: S/MIME Cryptographic Signature
Re: Wicket OSGi
Well yeah. I never meant for you to put actual code out there. But like you said a small quickstart with a readme would be great. -igor On 11/16/07, Ernesto Reinaldo Barreiro [EMAIL PROTECTED] wrote: Hi Igor, The main problem I see here is that there is not a single approach on building a wicket based OSGi application. For instance, we have taken a different approach to the one described in a previous e-mail. Moreover, as we had some code base already working when we decided go OSGi what we did was to look for a fast way to get that code base working on an OSGi environment: we simply couldn't go the PAX way because that would mean re-writing an existing code base. As we were using Eclipse as development tool the way we found to get back on track is eclipse dependent (in fact, equinox dependent, which is eclipses implementation of OSGi). As I mentioned before almost all problems we found boiled down to classloading issues. We have solved then using a technique called buddy class loading (equinox has an extension that makes it very easy to solve these problems). All this code is property of the company I work for, so it is not up to me to disclose it (or part of it). If you (and/or others) think it could be useful I could try to build a very simple (equinox depended) quick start sample application, maybe containing one or two bundles to illustrate how to solve classloading problems on equinox, as well as a README explaining how to get on track. Best regards, Ernesto Igor Vaynberg wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as
Re: Wicket OSGi
Hi, On Nov 16, 2007 6:12 PM, dado [EMAIL PROTECTED] wrote: Edgar, I am curious: what version of Jetty are you using? Where did you get the appropriate bundles? Could you share your Activator code that starts Jetty? Thanks again, I use the http service available in Apache Felix. br, Edgar David Edgar Poce wrote: Hi, In my spare time I'm building a CMS with wicket. I'm not developing it actively, just playing with it in my spare time. So far I developed the following bundles: Wicket as an osgi bundle: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-bundle/ A simple wicket example application: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-example/ JCR related bundles: http://mybundles.googlecode.com/svn/trunk/jcr/ A Pluto Container bundle that I plan to use to run portlets inside the CMS: http://mybundles.googlecode.com/svn/trunk/pluto/ hope it helps, edgar On Nov 16, 2007 1:16 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL
Re: Wicket OSGi
Ernesto, Your Equinox-based sample app using wicket would be of great interest! Many thanks, David Ernesto Reinaldo Barreiro wrote: Hi Igor, The main problem I see here is that there is not a single approach on building a wicket based OSGi application. For instance, we have taken a different approach to the one described in a previous e-mail. Moreover, as we had some code base already working when we decided go OSGi what we did was to look for a fast way to get that code base working on an OSGi environment: we simply couldn't go the PAX way because that would mean re-writing an existing code base. As we were using Eclipse as development tool the way we found to get back on track is eclipse dependent (in fact, equinox dependent, which is eclipses implementation of OSGi). As I mentioned before almost all problems we found boiled down to classloading issues. We have solved then using a technique called buddy class loading (equinox has an extension that makes it very easy to solve these problems). All this code is property of the company I work for, so it is not up to me to disclose it (or part of it). If you (and/or others) think it could be useful I could try to build a very simple (equinox depended) quick start sample application, maybe containing one or two bundles to illustrate how to solve classloading problems on equinox, as well as a README explaining how to get on track. Best regards, Ernesto Igor Vaynberg wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies --
Re: Wicket OSGi
Hi, In my spare time I'm building a CMS with wicket. I'm not developing it actively, just playing with it in my spare time. So far I developed the following bundles: Wicket as an osgi bundle: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-bundle/ A simple wicket example application: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-example/ JCR related bundles: http://mybundles.googlecode.com/svn/trunk/jcr/ A Pluto Container bundle that I plan to use to run portlets inside the CMS: http://mybundles.googlecode.com/svn/trunk/pluto/ hope it helps, edgar On Nov 16, 2007 1:16 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Wicket---OSGi-tf4805767.html#a13793200 Sent from the Wicket - User mailing list archive at Nabble.com. - To
Re: Wicket OSGi
perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Wicket---OSGi-tf4805767.html#a13793200 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Wicket---OSGi-tf4805767.html#a13793200 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
Edgar, Cool! I have been thinking Java could at long last have a good CMS, if someone were to do it using OSGi. I might want to be your first user. I am curious: what version of Jetty are you using? Where did you get the appropriate bundles? Could you share your Activator code that starts Jetty? Thanks again, David Edgar Poce wrote: Hi, In my spare time I'm building a CMS with wicket. I'm not developing it actively, just playing with it in my spare time. So far I developed the following bundles: Wicket as an osgi bundle: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-bundle/ A simple wicket example application: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-example/ JCR related bundles: http://mybundles.googlecode.com/svn/trunk/jcr/ A Pluto Container bundle that I plan to use to run portlets inside the CMS: http://mybundles.googlecode.com/svn/trunk/pluto/ hope it helps, edgar On Nov 16, 2007 1:16 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
Hi Igor, The main problem I see here is that there is not a single approach on building a wicket based OSGi application. For instance, we have taken a different approach to the one described in a previous e-mail. Moreover, as we had some code base already working when we decided go OSGi what we did was to look for a fast way to get that code base working on an OSGi environment: we simply couldn't go the PAX way because that would mean re-writing an existing code base. As we were using Eclipse as development tool the way we found to get back on track is eclipse dependent (in fact, equinox dependent, which is eclipses implementation of OSGi). As I mentioned before almost all problems we found boiled down to classloading issues. We have solved then using a technique called buddy class loading (equinox has an extension that makes it very easy to solve these problems). All this code is property of the company I work for, so it is not up to me to disclose it (or part of it). If you (and/or others) think it could be useful I could try to build a very simple (equinox depended) quick start sample application, maybe containing one or two bundles to illustrate how to solve classloading problems on equinox, as well as a README explaining how to get on track. Best regards, Ernesto Igor Vaynberg wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
David, Take a look here. http://www.eclipse.org/equinox/server/ They have bundled jetty as a pluging. So the only thing you have to do is start Jetty pluging as well. Don't know if other OSGi implementations offer something similar as well. Best regards, Ernesto dado wrote: Edgar, Cool! I have been thinking Java could at long last have a good CMS, if someone were to do it using OSGi. I might want to be your first user. I am curious: what version of Jetty are you using? Where did you get the appropriate bundles? Could you share your Activator code that starts Jetty? Thanks again, David Edgar Poce wrote: Hi, In my spare time I'm building a CMS with wicket. I'm not developing it actively, just playing with it in my spare time. So far I developed the following bundles: Wicket as an osgi bundle: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-bundle/ A simple wicket example application: http://mybundles.googlecode.com/svn/trunk/wicket/wicket-example/ JCR related bundles: http://mybundles.googlecode.com/svn/trunk/jcr/ A Pluto Container bundle that I plan to use to run portlets inside the CMS: http://mybundles.googlecode.com/svn/trunk/pluto/ hope it helps, edgar On Nov 16, 2007 1:16 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: perhaps one of the groups who are using wicket and osgi successfully can put together an example project that demonstrates all these concepts so the community does not have to reinvent the wheel and solve problems that have already been solved by others...thats what this is all about afterall -igor On Nov 16, 2007 5:37 AM, dado [EMAIL PROTECTED] wrote: Edgar and all, I am new to wicket but have built an application using Velocity and Equinox OSGi. I am hoping to switch from Velocity to Wicket. Edgar's code below is most helpful! Do you or anyone have any other code to share? Bundles? For example, this code would be helpful as well you have to register an OsgiWicketServlet instance in the HttpService. Thanks for your help! David Edgar Poce wrote: Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/
Re: Wicket OSGi
Hi, I ran a helloworld application in osgi, the only problem I found was a classloader issue, I had to use a custom IWebApplicationFactory. I copy the code bellow. In order to make it work you have to register an OsgiWicketServlet instance in the HttpService. hope it helps, Edgar public class OsgiWebApplicationFactory implements IWebApplicationFactory { private Class webApplication; public OsgiWebApplicationFactory(Class webApplication) { super(); this.webApplication = webApplication; } public WebApplication createApplication(WicketFilter filter) { try { return (WebApplication) this.webApplication.newInstance(); } catch (Exception e) { throw new RuntimeException(unable to start application, e); } } } public class OsgiWicketFilter extends WicketFilter { private Class webApplication; public OsgiWicketFilter(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected IWebApplicationFactory getApplicationFactory() { return new OsgiWebApplicationFactory(this.webApplication); } } public class OsgiWicketServlet extends WicketServlet { private String name; private Class webApplication; public OsgiWicketServlet(Class webApplication) { super(); this.webApplication = webApplication; } @Override protected WicketFilter newWicketFilter() { return new OsgiWicketFilter(this.webApplication); } /** * The servlet name can't contain * characters because Wicket uses the name * of the servlet to create a temporary folder. */ public String getServletName() { if (name == null) { synchronized (this) { name = super.getServletName(); if (name.endsWith(*)) { name = name.substring(0, name.length() - 1); } } } return name; } } On Nov 14, 2007 11:46 AM, Thies Edeling [EMAIL PROTECTED] wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies -- http://www.ehour.nl/ http://blog.ehour.nl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
We have gather some experience on using wicket and OSGi: we have been using them together for almost a year now. Instead of going the PAX way we chose to tie ourselves to equinox implementation of OSGi and we use some eclipse extensions to avoid class loading problems (look for *Eclipse*-*RegisterBuddy* header on manifest files). We have encountered all kinds of class loading related problems (e.g. when you want to integrate Hibernate into the picture or deploying the applicition into a real application server) but after having dealt with all these problems we are quite happy with the decision of going OSGi. Additionally, if you use eclipse 3.3. for development, it comes with a plugin version of Jetty that is quite handy for development... AFAIK if you plan to deploy your application in a real application server you will have to use equinox anyway because is the only implementation providing a Bridge servlet (that allows to start an OSGi runtime insede your application server). Here we have had class loading problems well as (in some application servers) you cannot simply do a JNDI lookup from withing a not WEB thread... Best regards, Ernesto Thies Edeling wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies
Re: Wicket OSGi
Hi, We are using Wicket as the UI layer in our OSGi application platform project. The registration of WicketServlet (or filter) is done in the very similar way like the Edgar wrote (even we have the same class names :)). And it is quite simple. The main problem is with Spring (precisely with spring bean injection). In OSGi each bundle has its own ApplicationContext (AppCtxt) and ClassLoader, so the standard Wicket mechanism (wicket-spring wicket-spring-annot) does not work when you want to use more than one bundle in your app. Problems: 1. There is one AppCtxt inside application (eg. SpringWebApplication), so when each bundle with your Wicket pages (panels, components, etc.) has its own AppCtxt you cannot get beans or inject beans in it. 2. InjectorHolder holds only one AppCtxt (it is used when you using injection outside components). I have to extend these mechanisms to support multiple AppCtxt. I only mention here that we have added a new interface to provide a proper injector: public interface InjectorProvider { ConfigurableInjector getInjector(); } and instead of using default InjectorHolder we use a there similar class ContextInjector, which is using InjectorProvider interface for resolving current injector. The simple implementation is (in apps outside OSGi - with only one AppCtxt): public class DefaultInjectorProvider implements InjectorProvider { public ConfigurableInjector getInjector() { return InjectorHolder.getInjector(); } } But inside OSGi injectors are hold in context of bunldes' class loaders. Maybe in the next versions of Wicket we should think about a small refactorization to support multiple AppCtxt ;). I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way. We don't use Pax. We have our own visual plugins' system based on pages and panels and we can use them to compose a pages or another plugins. Plugins can be delivered in different bundles. But it is a long story ;). Best regards, Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket OSGi
Hi Ernesto, You tell about some problems you met but could you summarize the benefits you had by adopting OSGI? Thanks, Serge. 2007/11/14, Ernesto Reinaldo Barreiro [EMAIL PROTECTED]: We have gather some experience on using wicket and OSGi: we have been using them together for almost a year now. Instead of going the PAX way we chose to tie ourselves to equinox implementation of OSGi and we use some eclipse extensions to avoid class loading problems (look for *Eclipse*-*RegisterBuddy* header on manifest files). We have encountered all kinds of class loading related problems (e.g. when you want to integrate Hibernate into the picture or deploying the applicition into a real application server) but after having dealt with all these problems we are quite happy with the decision of going OSGi. Additionally, if you use eclipse 3.3. for development, it comes with a plugin version of Jetty that is quite handy for development... AFAIK if you plan to deploy your application in a real application server you will have to use equinox anyway because is the only implementation providing a Bridge servlet (that allows to start an OSGi runtime insede your application server). Here we have had class loading problems well as (in some application servers) you cannot simply do a JNDI lookup from withing a not WEB thread... Best regards, Ernesto Thies Edeling wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies
Re: Wicket OSGi
Hi Serge, The main benefits I see are: -modularity: now our applications are composed of small modules adding specific functionality (e.g. scheduling, reporting,...). You don't need to use the whole stack but just those needed for your particular application (or those for which a customer has paid for;-). -pluggability. For instance, just by dropping a new bundle into the OSGi runtime all tables in our applications can suddenly export themselves to excel or pdf, or by adding another bundle tables can save snapshots of themselves, or a new bundle may add menu entries to the main application flow. All this without the need to stop the application. This is possible because many of our components consult some services, acting as extension points, at the time of building themselves. The bundles adding extra functionality can have also extension points that you can use to configure them (e.g. you may define exactly how you want to export to PDF or excel (headers, colors, and so on). So it opens up a lot of possibilities... Ernesto Serge Libotte wrote: Hi Ernesto, You tell about some problems you met but could you summarize the benefits you had by adopting OSGI? Thanks, Serge. 2007/11/14, Ernesto Reinaldo Barreiro [EMAIL PROTECTED]: We have gather some experience on using wicket and OSGi: we have been using them together for almost a year now. Instead of going the PAX way we chose to tie ourselves to equinox implementation of OSGi and we use some eclipse extensions to avoid class loading problems (look for *Eclipse*-*RegisterBuddy* header on manifest files). We have encountered all kinds of class loading related problems (e.g. when you want to integrate Hibernate into the picture or deploying the applicition into a real application server) but after having dealt with all these problems we are quite happy with the decision of going OSGi. Additionally, if you use eclipse 3.3. for development, it comes with a plugin version of Jetty that is quite handy for development... AFAIK if you plan to deploy your application in a real application server you will have to use equinox anyway because is the only implementation providing a Bridge servlet (that allows to start an OSGi runtime insede your application server). Here we have had class loading problems well as (in some application servers) you cannot simply do a JNDI lookup from withing a not WEB thread... Best regards, Ernesto Thies Edeling wrote: Hello all, Does anyone have any experience with using Wicket and OSGi? I'm looking for the most flexible way of composing an application and deploying Wicket pages/panels as OSGi bundles seems like a nice way.I noticed the Pax Wicket project but am not sure how stable that is. regards, Thies