ups, that one get lost on the way....
---------- Forwarded message ---------- From: Michael Szalay <[email protected]> Date: Mon, Apr 9, 2012 at 17:31 Subject: Re: Pax Wicket 1.0.0 on Karaf problems To: Andreas Pieber <[email protected]> You are right, It works when I provide a default constructor although its not used :-) I'll create a jira task later. Regards Michael Am 09.04.2012 16:58, schrieb Andreas Pieber: > @a) interesting workaround, but I think with a little bit of effort it > should also work with serialization. Basically the in-memory store is > quite a good idea IFF the number of users for your app is quite > limited. In case you expect 1k++ users to hammer constantly on your > size this could turn pretty fast into a problem; otherwise, happy that > it works now for you :-) > > @b) This is funny. I need to recheck this. Can you please verify the > following: does you bean work if you add a default constructor to your > bean? Independently of the results: can you please create a jira at > team.ops4j.org? I can give it a shot later this week. > > Kind regards, > Andreas > > On Mon, Apr 9, 2012 at 16:50, Michael Szalay<[email protected]> wrote: >> >> Hi Andreas >> >> thanks for you answer. >> >> Am 09.04.2012 10:47, schrieb Andreas Pieber: >> >>> Hey Michael, >>> >>> On Mon, Apr 9, 2012 at 09:16, Michael Szalay<[email protected]> >>> wrote: >>>> >>>> I'm evaluating pax-wicket 1.0.0 running on apache Karaf an have a few >>>> problems: >>>> >>>> a) Serialization of injected services: >>>> >>>> I'm injecting osgi-services using the PaxWicketBean annotation, like >>>> this: >>>> >>>> @PaxWicketBean(name = "searchService", injectionSource = >>>> PaxWicketBean.INJECTION_SOURCE_BLUEPRINT) >>>> private transient SearchService search; >>> >>> First of all: the injection source is typically not required; >>> pax-wicket automatically determines the available source and uses it. >> >> >> I needed to do that, else I had a ClassNotFoundException for class >> org.springframework.context... or something similar. >> But since I do not want to switch away from blueprint, I do not care about >> this ;-) >> >> >>>> As this is in a wicket page, it is Serializable, but my osgi-services of >>>> course aren't... >>>> so I declare it transient. >>>> When the page is called the second time, the SearchService is null, the >>>> first time it works. >>>> >>>> When I remove the "transient" modifier, there a lot a bunch of >>>> NotSerializable-Exceptions in the log >>>> and nothing works.. >>>> >>>> What Is the solution to deal with this problem? I can't make the services >>>> all serializable, >>>> since they are not my code... >>>> Is there a way to tell pax-wicket to not serialize the pages in a that >>>> strictly way? >>> >>> Well, the solution is definitely not to set the services transient or >>> to set them serializable. Nevertheless, what you mentioned is a bit of >>> a problem. Wicket stores services at various locations and you run >>> quite frequently into a situation where wicket itself tries to >>> serialize them. Typically those problems occur where you try to "give" >>> services into subcomponents. E.g. via a constructor, or a setter, or >>> ... Basically the PaxWicketBean annotation is filled for every >>> component again. Therefore you should NEVER store a bean injected >>> using PaxWicketBean anywhere but only use it. You can inject beans >>> into components, panels, pages, ... everywhere you like. Make use of >>> it. >>> >>> I hope this answers your question. If not feel free to give the code >>> samples a glance >>> https://github.com/ops4j/org.ops4j.pax.wicket/tree/master/samples or >>> feel free to publish the code snippets here (or send them to me >>> privately) and I'll give them a shot. >> >> Ok, I removed the "transient" modifier and customized my own >> PageManagerProvider... >> >> public class WicketApplication extends AuthenticatedWebApplication { >> /** >> * Constructor. >> */ >> public WicketApplication() { >> setConfigurationType(RuntimeConfigurationType.DEPLOYMENT); >> } >> >> @Override >> protected void init() { >> super.init(); >> setPageManagerProvider(new CustomPageManagerProvider(this, >> getPageManagerContext())); >> } >> >> ...which keeps everything in memory without serialization...this is even >> much faster then the lots of serialization work done >> at wicket default implementation. >> >> >>>> b) Injecting services which have a constructor with argument >>>> >>>> When I try to inject a service which has a constructor with argument, >>>> this >>>> gives a cglib-error when >>>> pax-wicket tries to create a proxy to it. >>> >>> Can you give an example here? I can't imagine how this can happen. The >>> entire construction is done by blueprint. Pax-Wicket only takes the >>> beans from the blueprint context. So I'm not sure how an exception can >>> happen here. It would definitely help if you could give me some >>> examples here of what you're trying to do. >> >> >> Example: >> >> <bean id="contentService" class="...ContentService"> >> <argument ref="repository" /> >> <argument ref="searchService" /> >> </bean> >> >> <!-- References --> >> <reference id="repository" interface=".....Repository" timeout="0" /> >> <reference id="searchService" interface="....SearchService" timeout="0" /> >> >> ..throws a.... >> >> java.lang.IllegalArgumentException: Superclass has no null constructors but >> no arguments were given >> at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:721) >> at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499) >> at >> net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) >> at >> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) >> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) >> at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285) >> at >> org.ops4j.pax.wicket.util.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:87) >> at >> org.ops4j.pax.wicket.internal.injection.BundleAnalysingComponentInstantiationListener.createProxy(BundleAnalysingComponentInstantiationListener.java:109) >> at >> org.ops4j.pax.wicket.internal.injection.BundleAnalysingComponentInstantiationListener.inject(BundleAnalysingComponentInstantiationListener.java:100) >> at >> org.ops4j.pax.wicket.internal.injection.BundleDelegatingComponentInstanciationListener.inject(BundleDelegatingComponentInstanciationListener.java:91) >> at >> org.ops4j.pax.wicket.internal.injection.DelegatingComponentInstanciationListener.inject(DelegatingComponentInstanciationListener.java:100) >> at >> org.ops4j.pax.wicket.internal.injection.ComponentInstantiationListenerFacade.onInstantiation(ComponentInstantiationListenerFacade.java:34) >> at >> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:36) >> at >> org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:33) >> at >> org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) >> at >> org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:32) >> at org.apache.wicket.Component.<init>(Component.java:678) >> at org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:118) >> at org.apache.wicket.Page.<init>(Page.java:206) >> at org.apache.wicket.Page.<init>(Page.java:170) >> at org.apache.wicket.markup.html.WebPage.<init>(WebPage.java:74) >> >> It works when I not inject the contentService into a wicket bean. >> There is IMHO a problem with using the cglib Procy stuff.... >> >> >> >>>> c) Authorization: >>>> >>>> Does role-based authorization work? I did'nt find the method >>>> "setAuthenticator" anymore... >>>> The wicket annotation seems not to be checked. >>> >>> Yes, that definitely work. I do it myself with various wicket >>> applications using pax-wicket. You need to set your own session in the >>> application. This should do the trick; in other words, what works in a >>> classical wicket app (e.g. auth) should work in pax-wicket the same >>> way. If you use something I've not used/tested by now (it's always >>> possible that we forgot a use case) please post a sample which will >>> work with plain wicket (attach it to a jira) and we'll give it a shot. >>> >>> Thank you your interest in Pax Wicket; I hope I was able to help you >>> at least with some of your questions.Feel free to ask again if I was >>> not able to answer something clearly enough. >>> >>> Kind regardsl, >>> Andreas >> >> >> Ooops, I forgot to extend from AuthenticatedWebApplication instead of >> WebApplication... >> This works now. >> >> Regards Michael >> >> >>>> Regards Michael >>>> >>>> _______________________________________________ >>>> general mailing list >>>> [email protected] >>>> http://lists.ops4j.org/mailman/listinfo/general >> >> >> >> -- >> Mail: michael.szalay(at)gmail.com >> Skype: michael_szalay >> michaelszalay.ch >> -- Mail: michael.szalay(at)gmail.com Skype: michael_szalay michaelszalay.ch _______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
