Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
@SpringBean isn't for use inside your Spring services, just Wicket
stuff.  Just use the native Spring injection mechanisms.  Try
@Autowired.

On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons  wrote:
> Hi there,
>
> For some time now I have been trying to put together a simple project to get
> me off the ground with a Wicket/Spring/Hibernate setup. I've had lots of ups
> and downs, and found this guide really useful:
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> However, I still seem to be having some problems and I've no idea where to
> look now.
>
> Here's the error I get in my log:
>
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'userServiceImpl' defined in file
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> Constructor threw exception; nested exception is org.apache.wicket.Wicket
> RuntimeException: There is no application attached to current thread
> ContainerBackgroundProcessor[StandardEngine[Catalina]]
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>        at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>        at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>        at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>        at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>        at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>        at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>        at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>        at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>        at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
>        at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>        at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>        at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
>        at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
>        at
> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
>        at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
>        at
> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
>        at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
>        at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>        at
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
>        at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
>        at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
>        at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: org.springframework.beans.BeanInstantiationException: Could not
> instantiate b

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Hi James,

Thanks for the suggestion! However, even with your change, I still get the
"There is no application attached to current thread
ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.

Regards,
Adam

On 15 December 2010 11:17, James Carman [via Apache Wicket] <
ml-node+3088802-1498820770-201...@n4.nabble.com
> wrote:

> @SpringBean isn't for use inside your Spring services, just Wicket
> stuff.  Just use the native Spring injection mechanisms.  Try
> @Autowired.
>
> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden 
> email]>
> wrote:
>
> > Hi there,
> >
> > For some time now I have been trying to put together a simple project to
> get
> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots of
> ups
> > and downs, and found this guide really useful:
> > http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> > However, I still seem to be having some problems and I've no idea where
> to
> > look now.
> >
> > Here's the error I get in my log:
> >
> > org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> > with name 'userServiceImpl' defined in file
> >
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>
> > Instantiation of bean failed; nested exception is
> > org.springframework.beans.BeanInstantiationException: Could not
> instantiate
> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> > Constructor threw exception; nested exception is org.apache.wicket.Wicket
>
> > RuntimeException: There is no application attached to current thread
> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
> >at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>
> >at java.security.AccessController.doPrivileged(Native Method)
> >at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>
> >at
> >
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>
> >at
> >
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>
> >at
> >
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>
> >at
> >
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>
> >at
> >
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>
> >at
> >
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>
> >at
> >
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>
> >at
> >
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>
> >at
> >
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>
> >at
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
>
> >at
> >
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>
> >at
> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> >at
> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
> >at
> > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
> >at
> > org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
> >at
> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
> >at
> > org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
> >at
> >
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
> >at
> >
> org.apache.cata

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
You need to be able to fire your spring context outside the context of
Wicket.  Can it be instantiated outside your container?  Once you get
that down, you should be good to go.

On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons  wrote:
>
> Hi James,
>
> Thanks for the suggestion! However, even with your change, I still get the
> "There is no application attached to current thread
> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
>
> Regards,
> Adam
>
> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> ml-node+3088802-1498820770-201...@n4.nabble.com
>> wrote:
>
>> @SpringBean isn't for use inside your Spring services, just Wicket
>> stuff.  Just use the native Spring injection mechanisms.  Try
>> @Autowired.
>>
>> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden 
>> email]>
>> wrote:
>>
>> > Hi there,
>> >
>> > For some time now I have been trying to put together a simple project to
>> get
>> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots of
>> ups
>> > and downs, and found this guide really useful:
>> > http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>> > However, I still seem to be having some problems and I've no idea where
>> to
>> > look now.
>> >
>> > Here's the error I get in my log:
>> >
>> > org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> > with name 'userServiceImpl' defined in file
>> >
>> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>>
>> > Instantiation of bean failed; nested exception is
>> > org.springframework.beans.BeanInstantiationException: Could not
>> instantiate
>> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
>> > Constructor threw exception; nested exception is org.apache.wicket.Wicket
>>
>> > RuntimeException: There is no application attached to current thread
>> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>
>> >        at java.security.AccessController.doPrivileged(Native Method)
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>
>> >        at
>> >
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>>
>> >        at
>> >
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>>
>> >        at
>> >
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>>
>> >        at
>> >
>> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>>
>> >        at
>> >
>> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>>
>> >        at
>> >
>> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>>
>> >        at
>> >
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>>
>> >        at
>> > org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
>>
>> >        at
>> >
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>>
>> >        at
>> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>> >        at
>> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
>> >        at
>> > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
>> >        at
>> > 

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

I thought that was the whole point of the Wicket-Spring project... That
tutorial looked like it worked as recently as a year ago. I find it hard to
believe that it's no longer possible or harder to integrate Wicket and
Spring than it was a year ago.

On researching that error, all I find are comments about deleting the
session file from Tomcat, and turning off session persistance. I've done
both and I still get the same start up error.



On 15 December 2010 13:53, James Carman [via Apache Wicket] <
ml-node+3089041-1452804699-201...@n4.nabble.com
> wrote:

> You need to be able to fire your spring context outside the context of
> Wicket.  Can it be instantiated outside your container?  Once you get
> that down, you should be good to go.
>
> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden 
> email]>
> wrote:
>
> >
> > Hi James,
> >
> > Thanks for the suggestion! However, even with your change, I still get
> the
> > "There is no application attached to current thread
> > ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
> >
> > Regards,
> > Adam
> >
> > On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> @SpringBean isn't for use inside your Spring services, just Wicket
> >> stuff.  Just use the native Spring injection mechanisms.  Try
> >> @Autowired.
> >>
> >> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
> >> wrote:
> >>
> >> > Hi there,
> >> >
> >> > For some time now I have been trying to put together a simple project
> to
> >> get
> >> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
> of
> >> ups
> >> > and downs, and found this guide really useful:
> >> >
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> >> > However, I still seem to be having some problems and I've no idea
> where
> >> to
> >> > look now.
> >> >
> >> > Here's the error I get in my log:
> >> >
> >> > org.springframework.beans.factory.BeanCreationException: Error
> creating
> >> bean
> >> > with name 'userServiceImpl' defined in file
> >> >
> >>
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>
> >>
> >> > Instantiation of bean failed; nested exception is
> >> > org.springframework.beans.BeanInstantiationException: Could not
> >> instantiate
> >> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> >> > Constructor threw exception; nested exception is
> org.apache.wicket.Wicket
> >>
> >> > RuntimeException: There is no application attached to current thread
> >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>
> >>
> >> >at java.security.AccessController.doPrivileged(Native Method)
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.refresh(

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread Matthias Gasser
Does the spring context startup without the wicket part?

I've integrated Wicket in an existing Spring project (following the 
same guide as you did) and it worked without any (greater) problem.

cheers,
Matthias

Am 15.12.2010 um 15:06 schrieb adam.gibbons:

> 
> I thought that was the whole point of the Wicket-Spring project... That
> tutorial looked like it worked as recently as a year ago. I find it hard to
> believe that it's no longer possible or harder to integrate Wicket and
> Spring than it was a year ago.
> 
> On researching that error, all I find are comments about deleting the
> session file from Tomcat, and turning off session persistance. I've done
> both and I still get the same start up error.
> 
> 
> 
> On 15 December 2010 13:53, James Carman [via Apache Wicket] <
> ml-node+3089041-1452804699-201...@n4.nabble.com
>> wrote:
> 
>> You need to be able to fire your spring context outside the context of
>> Wicket.  Can it be instantiated outside your container?  Once you get
>> that down, you should be good to go.
>> 
>> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden 
>> email]>
>> wrote:
>> 
>>> 
>>> Hi James,
>>> 
>>> Thanks for the suggestion! However, even with your change, I still get
>> the
>>> "There is no application attached to current thread
>>> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
>>> 
>>> Regards,
>>> Adam
>>> 
>>> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
>>> [hidden email] 
>>> <[hidden
>> email] >
 wrote:
>>> 
 @SpringBean isn't for use inside your Spring services, just Wicket
 stuff.  Just use the native Spring injection mechanisms.  Try
 @Autowired.
 
 On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
 wrote:
 
> Hi there,
> 
> For some time now I have been trying to put together a simple project
>> to
 get
> me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
>> of
 ups
> and downs, and found this guide really useful:
> 
>> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> However, I still seem to be having some problems and I've no idea
>> where
 to
> look now.
> 
> Here's the error I get in my log:
> 
> org.springframework.beans.factory.BeanCreationException: Error
>> creating
 bean
> with name 'userServiceImpl' defined in file
> 
 
>> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>> 
 
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not
 instantiate
> bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> Constructor threw exception; nested exception is
>> org.apache.wicket.Wicket
 
> RuntimeException: There is no application attached to current thread
> ContainerBackgroundProcessor[StandardEngine[Catalina]]
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>> 
 
>   at java.security.AccessController.doPrivileged(Native Method)
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>> 
 
>   at
> 
 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preIn

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
What's the code for UserServiceImpl?

On Wed, Dec 15, 2010 at 9:02 AM, adam.gibbons  wrote:
>
> New log:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'userServiceImpl' defined in file
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> Constructor threw exception; nested exception is org.apache.wicket.Wicket
> RuntimeException: There is no application attached to current thread
> ContainerBackgroundProcessor[StandardEngine[Catalina]]

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Hi Matthias,

Sorry, I'm not sure what you mean by that? If you look at the new log I just
posted, Spring seems to be starting up fine. How could I check it without
the wicket part? What would I need to change exactly?

Thanks,
Adam

On 15 December 2010 14:15, Matthias Gasser [via Apache Wicket] <
ml-node+3089072-2099328675-201...@n4.nabble.com
> wrote:

> Does the spring context startup without the wicket part?
>
> I've integrated Wicket in an existing Spring project (following the
> same guide as you did) and it worked without any (greater) problem.
>
> cheers,
> Matthias
>
> Am 15.12.2010 um 15:06 schrieb adam.gibbons:
>
> >
> > I thought that was the whole point of the Wicket-Spring project... That
> > tutorial looked like it worked as recently as a year ago. I find it hard
> to
> > believe that it's no longer possible or harder to integrate Wicket and
> > Spring than it was a year ago.
> >
> > On researching that error, all I find are comments about deleting the
> > session file from Tomcat, and turning off session persistance. I've done
> > both and I still get the same start up error.
> >
> >
> >
> > On 15 December 2010 13:53, James Carman [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> You need to be able to fire your spring context outside the context of
> >> Wicket.  Can it be instantiated outside your container?  Once you get
> >> that down, you should be good to go.
> >>
> >> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3089041&i=0>>
> >> wrote:
> >>
> >>>
> >>> Hi James,
> >>>
> >>> Thanks for the suggestion! However, even with your change, I still get
> >> the
> >>> "There is no application attached to current thread
> >>> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
> >>>
> >>> Regards,
> >>> Adam
> >>>
> >>> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> >>> [hidden email] 
> >>> <[hidden
>
> >> email] >
>  wrote:
> >>>
>  @SpringBean isn't for use inside your Spring services, just Wicket
>  stuff.  Just use the native Spring injection mechanisms.  Try
>  @Autowired.
> 
>  On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
>  wrote:
> 
> > Hi there,
> >
> > For some time now I have been trying to put together a simple project
>
> >> to
>  get
> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
>
> >> of
>  ups
> > and downs, and found this guide really useful:
> >
> >> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> > However, I still seem to be having some problems and I've no idea
> >> where
>  to
> > look now.
> >
> > Here's the error I get in my log:
> >
> > org.springframework.beans.factory.BeanCreationException: Error
> >> creating
>  bean
> > with name 'userServiceImpl' defined in file
> >
> 
> >>
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>
> >>
> 
> > Instantiation of bean failed; nested exception is
> > org.springframework.beans.BeanInstantiationException: Could not
>  instantiate
> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> > Constructor threw exception; nested exception is
> >> org.apache.wicket.Wicket
> 
> > RuntimeException: There is no application attached to current thread
> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>
> >>
> 
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>
> >>
> 
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>
> >>
> 
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>
> >>
> 
> >   at java.security.AccessController.doPrivileged(Native Method)
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> >>
> 
> >   at
> >
> 
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>
> >>

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

The UserServiceImpl code is in the first post.


On 15 December 2010 13:53, James Carman [via Apache Wicket] <
ml-node+3089041-1452804699-201...@n4.nabble.com
> wrote:

> You need to be able to fire your spring context outside the context of
> Wicket.  Can it be instantiated outside your container?  Once you get
> that down, you should be good to go.
>
> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden 
> email]>
> wrote:
>
> >
> > Hi James,
> >
> > Thanks for the suggestion! However, even with your change, I still get
> the
> > "There is no application attached to current thread
> > ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
> >
> > Regards,
> > Adam
> >
> > On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> @SpringBean isn't for use inside your Spring services, just Wicket
> >> stuff.  Just use the native Spring injection mechanisms.  Try
> >> @Autowired.
> >>
> >> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
> >> wrote:
> >>
> >> > Hi there,
> >> >
> >> > For some time now I have been trying to put together a simple project
> to
> >> get
> >> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
> of
> >> ups
> >> > and downs, and found this guide really useful:
> >> >
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> >> > However, I still seem to be having some problems and I've no idea
> where
> >> to
> >> > look now.
> >> >
> >> > Here's the error I get in my log:
> >> >
> >> > org.springframework.beans.factory.BeanCreationException: Error
> creating
> >> bean
> >> > with name 'userServiceImpl' defined in file
> >> >
> >>
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>
> >>
> >> > Instantiation of bean failed; nested exception is
> >> > org.springframework.beans.BeanInstantiationException: Could not
> >> instantiate
> >> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> >> > Constructor threw exception; nested exception is
> org.apache.wicket.Wicket
> >>
> >> > RuntimeException: There is no application attached to current thread
> >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>
> >>
> >> >at java.security.AccessController.doPrivileged(Native Method)
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>
> >>
> >> >at
> >> >
> >>
> org.springframework.web.context.ContextLoaderList

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
Spring is not starting up fine.  It's unable to instantiate the
UserServiceImpl bean which is why I asked for the code for that class.

On Wed, Dec 15, 2010 at 9:19 AM, adam.gibbons  wrote:
>
> Hi Matthias,
>
> Sorry, I'm not sure what you mean by that? If you look at the new log I just
> posted, Spring seems to be starting up fine. How could I check it without
> the wicket part? What would I need to change exactly?
>
> Thanks,
> Adam
>
> On 15 December 2010 14:15, Matthias Gasser [via Apache Wicket] <
> ml-node+3089072-2099328675-201...@n4.nabble.com
>> wrote:
>
>> Does the spring context startup without the wicket part?
>>
>> I've integrated Wicket in an existing Spring project (following the
>> same guide as you did) and it worked without any (greater) problem.
>>
>> cheers,
>> Matthias
>>
>> Am 15.12.2010 um 15:06 schrieb adam.gibbons:
>>
>> >
>> > I thought that was the whole point of the Wicket-Spring project... That
>> > tutorial looked like it worked as recently as a year ago. I find it hard
>> to
>> > believe that it's no longer possible or harder to integrate Wicket and
>> > Spring than it was a year ago.
>> >
>> > On researching that error, all I find are comments about deleting the
>> > session file from Tomcat, and turning off session persistance. I've done
>> > both and I still get the same start up error.
>> >
>> >
>> >
>> > On 15 December 2010 13:53, James Carman [via Apache Wicket] <
>> > [hidden email] 
>> > <[hidden
>> email] >
>> >> wrote:
>> >
>> >> You need to be able to fire your spring context outside the context of
>> >> Wicket.  Can it be instantiated outside your container?  Once you get
>> >> that down, you should be good to go.
>> >>
>> >> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=3089041&i=0>>
>> >> wrote:
>> >>
>> >>>
>> >>> Hi James,
>> >>>
>> >>> Thanks for the suggestion! However, even with your change, I still get
>> >> the
>> >>> "There is no application attached to current thread
>> >>> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
>> >>>
>> >>> Regards,
>> >>> Adam
>> >>>
>> >>> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
>> >>> [hidden email] 
>> >>> <[hidden
>>
>> >> email] >
>>  wrote:
>> >>>
>>  @SpringBean isn't for use inside your Spring services, just Wicket
>>  stuff.  Just use the native Spring injection mechanisms.  Try
>>  @Autowired.
>> 
>>  On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
>> >> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
>>  wrote:
>> 
>> > Hi there,
>> >
>> > For some time now I have been trying to put together a simple project
>>
>> >> to
>>  get
>> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
>>
>> >> of
>>  ups
>> > and downs, and found this guide really useful:
>> >
>> >> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>> > However, I still seem to be having some problems and I've no idea
>> >> where
>>  to
>> > look now.
>> >
>> > Here's the error I get in my log:
>> >
>> > org.springframework.beans.factory.BeanCreationException: Error
>> >> creating
>>  bean
>> > with name 'userServiceImpl' defined in file
>> >
>> 
>> >>
>> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>>
>> >>
>> 
>> > Instantiation of bean failed; nested exception is
>> > org.springframework.beans.BeanInstantiationException: Could not
>>  instantiate
>> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
>> > Constructor threw exception; nested exception is
>> >> org.apache.wicket.Wicket
>> 
>> > RuntimeException: There is no application attached to current thread
>> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
>> >       at
>> >
>> 
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>>
>> >>
>> 
>> >       at
>> >
>> 
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>>
>> >>
>> 
>> >       at
>> >
>> 
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>>
>> >>
>> 
>> >       at
>> >
>> 
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>
>> >>
>> 
>> >       at java.security.AccessController.doPrivileged(Na

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
So, you didn't change UserServiceImpl, as I suggested?  The section
you need to change is:

@SpringBean
private Temp1DAO temp1DAO;

Change that to @Autowired instead of @SpringBean




On Wed, Dec 15, 2010 at 9:23 AM, adam.gibbons  wrote:
>
> The UserServiceImpl code is in the first post.
>
>
> On 15 December 2010 13:53, James Carman [via Apache Wicket] <
> ml-node+3089041-1452804699-201...@n4.nabble.com
>> wrote:
>
>> You need to be able to fire your spring context outside the context of
>> Wicket.  Can it be instantiated outside your container?  Once you get
>> that down, you should be good to go.
>>
>> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden 
>> email]>
>> wrote:
>>
>> >
>> > Hi James,
>> >
>> > Thanks for the suggestion! However, even with your change, I still get
>> the
>> > "There is no application attached to current thread
>> > ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
>> >
>> > Regards,
>> > Adam
>> >
>> > On 15 December 2010 11:17, James Carman [via Apache Wicket] <
>> > [hidden email] 
>> > <[hidden
>> email] >
>> >> wrote:
>> >
>> >> @SpringBean isn't for use inside your Spring services, just Wicket
>> >> stuff.  Just use the native Spring injection mechanisms.  Try
>> >> @Autowired.
>> >>
>> >> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
>> >> wrote:
>> >>
>> >> > Hi there,
>> >> >
>> >> > For some time now I have been trying to put together a simple project
>> to
>> >> get
>> >> > me off the ground with a Wicket/Spring/Hibernate setup. I've had lots
>> of
>> >> ups
>> >> > and downs, and found this guide really useful:
>> >> >
>> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>> >> > However, I still seem to be having some problems and I've no idea
>> where
>> >> to
>> >> > look now.
>> >> >
>> >> > Here's the error I get in my log:
>> >> >
>> >> > org.springframework.beans.factory.BeanCreationException: Error
>> creating
>> >> bean
>> >> > with name 'userServiceImpl' defined in file
>> >> >
>> >>
>> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>>
>> >>
>> >> > Instantiation of bean failed; nested exception is
>> >> > org.springframework.beans.BeanInstantiationException: Could not
>> >> instantiate
>> >> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
>> >> > Constructor threw exception; nested exception is
>> org.apache.wicket.Wicket
>> >>
>> >> > RuntimeException: There is no application attached to current thread
>> >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>>
>> >>
>> >> >        at java.security.AccessController.doPrivileged(Native Method)
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>>
>> >>
>> >> >        at
>> >> >
>> >>
>> org.springframework.context.support.AbstractApplicationContext.refres

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Yes but directly below it states: "Caused by:
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [uk.co.company.product.business.spring.UserServiceImpl]:
Constructor threw exception; nested exception is
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread ContainerBackgroundProcessor[StandardEngine[Catalina]]"

...so it's the same error.

here is the code for UserServiceImpl again:

@Service
public class UserServiceImpl extends _AbstractService implements
UserService{

final private TestUserService testUserService = new TestUserService();

@Autowired
private Temp1DAO temp1DAO;
@Override
@Required
final public void setTemp1DAO(final Temp1DAO temp1dao){
temp1DAO = temp1dao;
}

public UserServiceImpl(){
super();
InjectorHolder.getInjector().inject(this);//<-- VERY IMPORTANT to
get Spring DI to work.
}

/* (non-Javadoc)
 * @see
uk.co.company.product.business.spring.UserService#authenticate(java.lang.String,
java.lang.String)
 */
@Override
@Transactional
final public boolean authenticate(final String userName, final String
password){
final Temp1 temp1 = new Temp1();
temp1.setValue(userName);
temp1DAO.save(temp1);
return testUserService.authenticate(userName, password);
}

/* (non-Javadoc)
 * @see
uk.co.company.product.business.spring.UserService#getRoles(java.lang.String,
boolean)
 */
@Override
@Transactional
final public Roles getRoles(final String userName, final boolean
signedIn){
return testUserService.getRoles(userName, signedIn);
}
}


On 15 December 2010 14:26, James Carman [via Apache Wicket] <
ml-node+3089100-955689425-201...@n4.nabble.com
> wrote:

> Spring is not starting up fine.  It's unable to instantiate the
> UserServiceImpl bean which is why I asked for the code for that class.
>
> On Wed, Dec 15, 2010 at 9:19 AM, adam.gibbons <[hidden 
> email]>
> wrote:
>
> >
> > Hi Matthias,
> >
> > Sorry, I'm not sure what you mean by that? If you look at the new log I
> just
> > posted, Spring seems to be starting up fine. How could I check it without
>
> > the wicket part? What would I need to change exactly?
> >
> > Thanks,
> > Adam
> >
> > On 15 December 2010 14:15, Matthias Gasser [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> Does the spring context startup without the wicket part?
> >>
> >> I've integrated Wicket in an existing Spring project (following the
> >> same guide as you did) and it worked without any (greater) problem.
> >>
> >> cheers,
> >> Matthias
> >>
> >> Am 15.12.2010 um 15:06 schrieb adam.gibbons:
> >>
> >> >
> >> > I thought that was the whole point of the Wicket-Spring project...
> That
> >> > tutorial looked like it worked as recently as a year ago. I find it
> hard
> >> to
> >> > believe that it's no longer possible or harder to integrate Wicket and
>
> >> > Spring than it was a year ago.
> >> >
> >> > On researching that error, all I find are comments about deleting the
> >> > session file from Tomcat, and turning off session persistance. I've
> done
> >> > both and I still get the same start up error.
> >> >
> >> >
> >> >
> >> > On 15 December 2010 13:53, James Carman [via Apache Wicket] <
> >> > [hidden email] 
> >> > <[hidden
>
> >> email] >
> >> >> wrote:
> >> >
> >> >> You need to be able to fire your spring context outside the context
> of
> >> >> Wicket.  Can it be instantiated outside your container?  Once you get
>
> >> >> that down, you should be good to go.
> >> >>
> >> >> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=3089041&i=0>>
> >> >> wrote:
> >> >>
> >> >>>
> >> >>> Hi James,
> >> >>>
> >> >>> Thanks for the suggestion! However, even with your change, I still
> get
> >> >> the
> >> >>> "There is no application attached to current thread
> >> >>> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
> >> >>>
> >> >>> Regards,
> >> >>> Adam
> >> >>>
> >> >>> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> >> >>> [hidden email] <
> http://user/SendEmail.jtp?type=node&node=3089041&i=1><[hidden
> >>
> >> >> email] >
> >>  wrote:
> >> >>>
> >>  @SpringBean isn't for use inside your Spring services, just Wicket
> >>  stuff.  Just use the native Spring injection mechanisms.  Try
> >>  @Autowired.
> >> 
> >>  On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
> >> >> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
> >>  wrote:
> >> 
> >> > Hi th

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Sorry perhaps I didn't make that clear before. I made that change as you
suggested and this is the result.


On 15 December 2010 14:28, James Carman [via Apache Wicket] <
ml-node+3089111-1454695690-201...@n4.nabble.com
> wrote:

> So, you didn't change UserServiceImpl, as I suggested?  The section
> you need to change is:
>
> @SpringBean
> private Temp1DAO temp1DAO;
>
> Change that to @Autowired instead of @SpringBean
>
>
>
>
> On Wed, Dec 15, 2010 at 9:23 AM, adam.gibbons <[hidden 
> email]>
> wrote:
>
> >
> > The UserServiceImpl code is in the first post.
> >
> >
> > On 15 December 2010 13:53, James Carman [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> You need to be able to fire your spring context outside the context of
> >> Wicket.  Can it be instantiated outside your container?  Once you get
> >> that down, you should be good to go.
> >>
> >> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3089041&i=0>>
> >> wrote:
> >>
> >> >
> >> > Hi James,
> >> >
> >> > Thanks for the suggestion! However, even with your change, I still get
>
> >> the
> >> > "There is no application attached to current thread
> >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
> >> >
> >> > Regards,
> >> > Adam
> >> >
> >> > On 15 December 2010 11:17, James Carman [via Apache Wicket] <
> >> > [hidden email] 
> >> > <[hidden
>
> >> email] >
> >> >> wrote:
> >> >
> >> >> @SpringBean isn't for use inside your Spring services, just Wicket
> >> >> stuff.  Just use the native Spring injection mechanisms.  Try
> >> >> @Autowired.
> >> >>
> >> >> On Wed, Dec 15, 2010 at 5:43 AM, Adam Gibbons <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=3088802&i=0>>
> >> >> wrote:
> >> >>
> >> >> > Hi there,
> >> >> >
> >> >> > For some time now I have been trying to put together a simple
> project
> >> to
> >> >> get
> >> >> > me off the ground with a Wicket/Spring/Hibernate setup. I've had
> lots
> >> of
> >> >> ups
> >> >> > and downs, and found this guide really useful:
> >> >> >
> >> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> >> >> > However, I still seem to be having some problems and I've no idea
> >> where
> >> >> to
> >> >> > look now.
> >> >> >
> >> >> > Here's the error I get in my log:
> >> >> >
> >> >> > org.springframework.beans.factory.BeanCreationException: Error
> >> creating
> >> >> bean
> >> >> > with name 'userServiceImpl' defined in file
> >> >> >
> >> >>
> >>
> [C:\tomcat6\webapps\ZenTemplate-0\WEB-INF\classes\uk\co\company\product\business\spring\UserServiceImpl.class]:
>
> >>
> >> >>
> >> >> > Instantiation of bean failed; nested exception is
> >> >> > org.springframework.beans.BeanInstantiationException: Could not
> >> >> instantiate
> >> >> > bean class [uk.co.company.product.business.spring.UserServiceImpl]:
>
> >> >> > Constructor threw exception; nested exception is
> >> org.apache.wicket.Wicket
> >> >>
> >> >> > RuntimeException: There is no application attached to current
> thread
> >> >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>
> >>
> >> >>
> >> >> >at java.security.AccessController.doPrivileged(Native
> Method)
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
> >>
> >> >>
> >> >> >at
> >> >> >
> >> >>
> >>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>
> >>
> >> >>
> >> >> >at

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
Get rid of the InjectorHolder code in your constructor.

On Wed, Dec 15, 2010 at 9:39 AM, adam.gibbons  wrote:
>
> Yes but directly below it states: "Caused by:
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [uk.co.company.product.business.spring.UserServiceImpl]:
> Constructor threw exception; nested exception is
> org.apache.wicket.WicketRuntimeException: There is no application attached
> to current thread ContainerBackgroundProcessor[StandardEngine[Catalina]]"
>
> ...so it's the same error.
>
> here is the code for UserServiceImpl again:
>
> @Service
> public class UserServiceImpl extends _AbstractService implements
> UserService{
>
>    final private TestUserService testUserService = new TestUserService();
>
>   �...@autowired
>    private Temp1DAO temp1DAO;
>   �...@override
>   �...@required
>    final public void setTemp1DAO(final Temp1DAO temp1dao){
>        temp1DAO = temp1dao;
>    }
>
>    public UserServiceImpl(){
>        super();
>        InjectorHolder.getInjector().inject(this);//<-- VERY IMPORTANT to
> get Spring DI to work.
>    }
>
>    /* (non-Javadoc)
>     * @see
> uk.co.company.product.business.spring.UserService#authenticate(java.lang.String,
> java.lang.String)
>     */
>   �...@override
>   �...@transactional
>    final public boolean authenticate(final String userName, final String
> password){
>        final Temp1 temp1 = new Temp1();
>        temp1.setValue(userName);
>        temp1DAO.save(temp1);
>        return testUserService.authenticate(userName, password);
>    }
>
>    /* (non-Javadoc)
>     * @see
> uk.co.company.product.business.spring.UserService#getRoles(java.lang.String,
> boolean)
>     */
>   �...@override
>   �...@transactional
>    final public Roles getRoles(final String userName, final boolean
> signedIn){
>        return testUserService.getRoles(userName, signedIn);
>    }
> }
>
>
> On 15 December 2010 14:26, James Carman [via Apache Wicket] <
> ml-node+3089100-955689425-201...@n4.nabble.com
>> wrote:
>
>> Spring is not starting up fine.  It's unable to instantiate the
>> UserServiceImpl bean which is why I asked for the code for that class.
>>
>> On Wed, Dec 15, 2010 at 9:19 AM, adam.gibbons <[hidden 
>> email]>
>> wrote:
>>
>> >
>> > Hi Matthias,
>> >
>> > Sorry, I'm not sure what you mean by that? If you look at the new log I
>> just
>> > posted, Spring seems to be starting up fine. How could I check it without
>>
>> > the wicket part? What would I need to change exactly?
>> >
>> > Thanks,
>> > Adam
>> >
>> > On 15 December 2010 14:15, Matthias Gasser [via Apache Wicket] <
>> > [hidden email] 
>> > <[hidden
>> email] >
>> >> wrote:
>> >
>> >> Does the spring context startup without the wicket part?
>> >>
>> >> I've integrated Wicket in an existing Spring project (following the
>> >> same guide as you did) and it worked without any (greater) problem.
>> >>
>> >> cheers,
>> >> Matthias
>> >>
>> >> Am 15.12.2010 um 15:06 schrieb adam.gibbons:
>> >>
>> >> >
>> >> > I thought that was the whole point of the Wicket-Spring project...
>> That
>> >> > tutorial looked like it worked as recently as a year ago. I find it
>> hard
>> >> to
>> >> > believe that it's no longer possible or harder to integrate Wicket and
>>
>> >> > Spring than it was a year ago.
>> >> >
>> >> > On researching that error, all I find are comments about deleting the
>> >> > session file from Tomcat, and turning off session persistance. I've
>> done
>> >> > both and I still get the same start up error.
>> >> >
>> >> >
>> >> >
>> >> > On 15 December 2010 13:53, James Carman [via Apache Wicket] <
>> >> > [hidden email] 
>> >> > <[hidden
>>
>> >> email] >
>> >> >> wrote:
>> >> >
>> >> >> You need to be able to fire your spring context outside the context
>> of
>> >> >> Wicket.  Can it be instantiated outside your container?  Once you get
>>
>> >> >> that down, you should be good to go.
>> >> >>
>> >> >> On Wed, Dec 15, 2010 at 8:50 AM, adam.gibbons <[hidden email]<
>> >> http://user/SendEmail.jtp?type=node&node=3089041&i=0>>
>> >> >> wrote:
>> >> >>
>> >> >>>
>> >> >>> Hi James,
>> >> >>>
>> >> >>> Thanks for the suggestion! However, even with your change, I still
>> get
>> >> >> the
>> >> >>> "There is no application attached to current thread
>> >> >>> ContainerBackgroundProcessor[StandardEngine[Catalina]]" error.
>> >> >>>
>> >> >>> Regards,
>> >> >>> Adam
>> >> >>>
>> >> >>> On 15 December 2010 11:17, James Carman [via Apache Wicket] <
>> >> >>> [hidden email] <
>> http://user/SendEmail.jtp?type=node&node=3089041&i=1><[hidden
>> >>
>> >> >> email] >
>> >>  wrote:
>> >> >>>
>> >>  @SpringBean isn't for use inside your Sprin

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
Put a log statement in your DAO's constructor to see if it's getting
instantiated (it's probably not).  Then turn on component scanning as
suggested by someone else.


On Wed, Dec 15, 2010 at 10:01 AM, adam.gibbons  wrote:
>
> There is definitely only 1 implementation. I read the error as it finds 0
> implementations...
>
> On 15 December 2010 14:54, jcgarciam [via Apache Wicket] <
> ml-node+3089160-35062030-201...@n4.nabble.com
>> wrote:
>
>> It seems be two Implementation in the classpath, and �...@autowired can't 
>> pick
>> one of them.
>>
>> On Wed, Dec 15, 2010 at 11:50 AM, James Carman [via Apache Wicket] <[hidden
>> email] > wrote:
>>
>>> Now this isn't a Wicket question.  This is a Spring question.  Wrong
>>> forum.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Ok, I think this is now back to a Wicket question. Start up is ok now.
However when I try and invoke UserServiceImpl.authenticate(){
final Temp1 temp1 = new Temp1();
temp1.setValue(userName);
temp1DAO.save(temp1);
return testUserService.authenticate(userName, password);
}

I get the following error through the GUI:

Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = signInForm]] threw an exception

Root cause:

org.hibernate.HibernateException: persist is not valid without active
transaction
at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy18.persist(Unknown Source)
at
uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
at
uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy9.save(Unknown Source)
at
uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy10.authenticate(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
at org.apache.wicket.proxy.$Proxy15.authenticate(Unknown Source)
at
uk.co.company.product.presentation.wicket.app.CustomAuthenticatedWebSession.authenticate(CustomAuthenticatedWebSession.java:29)

I was under the impression that the OpenSessionInViewFilter was supposed to
do this for us?


Once again here is the source code:


web.xml:


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
"
version="2.4"
>
ZenTemplate

contextConfigLocation
classpath:applicationContext.xml



org.springframework.web.context.ContextLoaderListener


opensessioninview

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


wicket-spring-hibernate

org.apache.wicket.protocol.http.WicketFilter

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory


applicationClassName

uk.co.company.product.presentation.wicket.app.WicketApplication



opensessioninview
/*


wicket-spring-hibernate
/*





applicationContext.xml:


http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:aop="http://www.springframework.org/schema/aop";
xmlns:tx="http://www.springframework.org/schema/tx";
xmlns:context="http://www.springframework.org/schema/context";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
"
default-autowire="byType"
default-lazy-init="false"
>







classpath*:/application.properties




${jdbc.driver}
${jdbc.url}
${jdbc.username}
${jdbc.password}





Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread jcgarciam

In your web.xml

the OSV Filter must comes in front (first) of the wicket filter

On Wed, Dec 15, 2010 at 12:58 PM, adam.gibbons [via Apache Wicket] <
ml-node+3089284-1530997070-65...@n4.nabble.com
> wrote:

> Ok, I think this is now back to a Wicket question. Start up is ok now.
> However when I try and invoke UserServiceImpl.authenticate(){
>
> final Temp1 temp1 = new Temp1();
> temp1.setValue(userName);
> temp1DAO.save(temp1);
> return testUserService.authenticate(userName, password);
> }
>
> I get the following error through the GUI:
>
> Method onFormSubmitted of interface
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
> [MarkupContainer [Component id = signInForm]] threw an exception
>
> Root cause:
>
> org.hibernate.HibernateException: persist is not valid without active
> transaction
> at
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
> at $Proxy18.persist(Unknown Source)
> at
> uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
> at
> uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy9.save(Unknown Source)
> at
> uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy10.authenticate(Unknown Source)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
> at org.apache.wicket.proxy.$Proxy15.authenticate(Unknown Source)
> at
> uk.co.company.product.presentation.wicket.app.CustomAuthenticatedWebSession.authenticate(CustomAuthenticatedWebSession.java:29)
>
> I was under the impression that the OpenSessionInViewFilter was supposed to
> do this for us?
>
>
> Once again here is the source code:
>
>
>
> web.xml:
>
> 
>  xmlns="http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="
> http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
> "
> version="2.4"
> >
> ZenTemplate
> 
> contextConfigLocation
> classpath:applicationContext.xml
> 
> 
>
> org.springframework.web.context.ContextLoaderListener
> 
> 
> opensessioninview
>
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> 
> 
> wicket-spring-hibernate
>
> org.apache.wicket.protocol.http.WicketFilter
> 
> applicationFactoryClassName
>
> org.apache.wicket.spring.SpringWebApplicationFactory
> 
> 
> applicationClassName
>
> uk.co.company.product.presentation.wicket.app.WicketApplication
> 
> 
> 
> opensessioninview
> /*
> 
> 
> wicket-spring-hibernate
> /*
> 
> 
>
>
>
> applicationContext.xml:
>
> 
>  xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:aop="http://www.springframework.org/schema/aop";
> xmlns:tx="http://www.springframework.org/schema/tx";
> xmlns:context="http://www.springframework.org/schema/context";
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> http://www.springframew

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread Hielke Hoeve
Hey Adam,

This is still a spring error, you need a sessionfactory and
transactionfactory and link them together. The opensessioninview filter only
opens a transaction if you get this right. The spring forums are filled with
examples.

Hielke
On 15 Dec 2010 16:58, "adam.gibbons"  wrote:
>
>
> Ok, I think this is now back to a Wicket question. Start up is ok now.
> However when I try and invoke UserServiceImpl.authenticate(){
>final Temp1 temp1 = new Temp1();
>temp1.setValue(userName);
>temp1DAO.save(temp1);
>return testUserService.authenticate(userName, password);
> }
>
> I get the following error through the GUI:
>
> Method onFormSubmitted of interface
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component
> [MarkupContainer [Component id = signInForm]] threw an exception
>
> Root cause:
>
> org.hibernate.HibernateException: persist is not valid without active
> transaction
> at
>
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
> at $Proxy18.persist(Unknown Source)
> at
>
uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
> at
>
uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
> at
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
>
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy9.save(Unknown Source)
> at
>
uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
> at
>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
> at
>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
>
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy10.authenticate(Unknown Source)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
>
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
> at org.apache.wicket.proxy.$Proxy15.authenticate(Unknown Source)
> at
>
uk.co.company.product.presentation.wicket.app.CustomAuthenticatedWebSession.authenticate(CustomAuthenticatedWebSession.java:29)
>
> I was under the impression that the OpenSessionInViewFilter was supposed
to
> do this for us?
>
>
> Once again here is the source code:
>
>
> web.xml:
>
> 
> xmlns="http://java.sun.com/xml/ns/j2ee";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xsi:schemaLocation="
>http://java.sun.com/xml/ns/j2ee
>http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
>"
>version="2.4"
> >
>ZenTemplate
>
>contextConfigLocation
>classpath:applicationContext.xml
>
>
>
>
org.springframework.web.context.ContextLoaderListener
>
>
>opensessioninview
>
>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>
>
>wicket-spring-hibernate
>
> org.apache.wicket.protocol.http.WicketFilter
>
>applicationFactoryClassName
>
>
org.apache.wicket.spring.SpringWebApplicationFactory
>
>
>applicationClassName
>
>
uk.co.company.product.presentation.wicket.app.WicketApplication
>
>
>
>opensessioninview
>/*
>
>
>wicket-spring-hibernate
>/*
>
> 
>
>
>
> applicationContext.xml:
>
> 
> xmlns="http://www.springframework.org/schema/beans";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xmlns:aop="http://www.springframework.org/schema/aop";
>xmlns:tx="http://www.springframework.org/schema/tx";
>xmlns:context="http://www.springframework.org/schema/context";
>xsi:schemaLocation="
>http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Like this?:


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
"
version="2.4"
>
ZenTemplate

contextConfigLocation
classpath:applicationContext.xml



org.springframework.web.context.ContextLoaderListener


opensessioninview

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


wicket-spring-hibernate

org.apache.wicket.protocol.http.WicketFilter

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory


applicationClassName

uk.co.company.product.presentation.wicket.app.WicketApplication



opensessioninview
/*


wicket-spring-hibernate
/*




On 15 December 2010 16:15, jcgarciam [via Apache Wicket] <
ml-node+3089321-765746748-201...@n4.nabble.com
> wrote:

> In your web.xml
>
> the OSV Filter must comes in front (first) of the wicket filter
>
> On Wed, Dec 15, 2010 at 12:58 PM, adam.gibbons [via Apache Wicket] <[hidden
> email] > wrote:
>
>> Ok, I think this is now back to a Wicket question. Start up is ok now.
>> However when I try and invoke UserServiceImpl.authenticate(){
>>
>> final Temp1 temp1 = new Temp1();
>> temp1.setValue(userName);
>> temp1DAO.save(temp1);
>> return testUserService.authenticate(userName, password);
>> }
>>
>> I get the following error through the GUI:
>>
>> Method onFormSubmitted of interface
>> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
>> [MarkupContainer [Component id = signInForm]] threw an exception
>>
>> Root cause:
>>
>> org.hibernate.HibernateException: persist is not valid without active
>> transaction
>> at
>> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
>> at $Proxy18.persist(Unknown Source)
>> at
>> uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
>> at
>> uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> at
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy9.save(Unknown Source)
>> at
>> uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> at
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy10.authenticate(Unknown Source)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
>> at org.apache.wicket.proxy.$Proxy15.authenticate(Unknown Source)
>> at
>> uk.co.company.product.presentation.wicket.app.CustomAuthenticatedWebSession.authenticate(CustomAuthenticatedWebSession.java:29)
>>
>> I was under the impression that the OpenSessionInViewFilter was supposed
>> to do this for us?
>>
>>
>> Once again here is the source code:
>>
>>
>>
>> web.xml:
>>
>> 
>> > xmlns="http://java.sun.com/xml/ns/j2ee";
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> xsi:schemaLocation="
>> http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
>> "
>> version="2.4"
>> >
>> ZenTemplate
>> 
>> contextConfigLocation
>> classpath:applicationContext.xml
>> 
>> 
>>
>> org.springframework.web.context.ContextLoaderListener
>> 
>> 
>> opensessioninview
>>

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread adam.gibbons

Hi Hielke,

Thank you for the helpful reply. :) But I think I already have those in my
applicationConext.xml...:



http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:aop="http://www.springframework.org/schema/aop";
xmlns:tx="http://www.springframework.org/schema/tx";
xmlns:context="http://www.springframework.org/schema/context";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
"
default-autowire="byType"
default-lazy-init="false"
>







classpath*:/application.properties




${jdbc.driver}
${jdbc.url}
${jdbc.username}
${jdbc.password}















${hibernate.dialect}
true
hibernate.format_sql
zen_template
2

pojo
true
true
true
thread
true



true
true

8
false
5




 
 true
true






uk.co.company.product.persistance.hibernate


 
 





On 15 December 2010 16:17, Hielke Hoeve [via Apache Wicket] <
ml-node+3089324-1169388531-201...@n4.nabble.com
> wrote:

> Hey Adam,
>
> This is still a spring error, you need a sessionfactory and
> transactionfactory and link them together. The opensessioninview filter
> only
> opens a transaction if you get this right. The spring forums are filled
> with
> examples.
>
> Hielke
> On 15 Dec 2010 16:58, "adam.gibbons" <[hidden 
> email]>
> wrote:
>
> >
> >
> > Ok, I think this is now back to a Wicket question. Start up is ok now.
> > However when I try and invoke UserServiceImpl.authenticate(){
> >final Temp1 temp1 = new Temp1();
> >temp1.setValue(userName);
> >temp1DAO.save(temp1);
> >return testUserService.authenticate(userName, password);
> > }
> >
> > I get the following error through the GUI:
> >
> > Method onFormSubmitted of interface
> > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> component
> > [MarkupContainer [Component id = signInForm]] threw an exception
> >
> > Root cause:
> >
> > org.hibernate.HibernateException: persist is not valid without active
> > transaction
> > at
> >
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
>
> > at $Proxy18.persist(Unknown Source)
> > at
> >
> uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
>
> > at
> >
> uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
>
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> >
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>
> > at
> >
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>
> > at
> >
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>
> > at
> >
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> > at
> >
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>
> > at
> >
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>
> > at $Proxy9.save(Unknown Source)
> > at
> >
> uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
>
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> >
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>
> > at
> >
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>
> > at
> >
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>
> > at
> >
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInte

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread James Carman
You also need to make sure you've set up your transactions properly.
Are you using the @Transactional annotations?

On Wed, Dec 15, 2010 at 11:40 AM, adam.gibbons  wrote:
>
> Hi Hielke,
>
> Thank you for the helpful reply. :) But I think I already have those in my
> applicationConext.xml...:
>
>
> 
>     xmlns="http://www.springframework.org/schema/beans";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>    xmlns:aop="http://www.springframework.org/schema/aop";
>    xmlns:tx="http://www.springframework.org/schema/tx";
>    xmlns:context="http://www.springframework.org/schema/context";
>    xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>        http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>        http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
>        http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>    "
>    default-autowire="byType"
>    default-lazy-init="false"
>>
>     class="uk.co.company.product.presentation.wicket.app.WicketApplication" />
>
>     class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
> autowire="byName">
>        
>         value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
>        
>        
>            classpath*:/application.properties
>        
>    
>
>     class="org.springframework.jdbc.datasource.DriverManagerDataSource"
> autowire="byName">
>         name="driverClassName">${jdbc.driver}
>        ${jdbc.url}
>        ${jdbc.username}
>        ${jdbc.password}
>    
>
>    
>
>     class="org.springframework.orm.hibernate3.HibernateTransactionManager"
> autowire="byName">
>        
>    
>
>    
>
>     class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
> autowire="byName">
>        
>        
>            
>                
>                ${hibernate.dialect}
>                true
>                hibernate.format_sql
>                zen_template
>                2
>                
>                pojo
>                true
>                true
>                true
>                 key="hibernate.current_session_context_class">thread
>                true
>                
>                
>                
>                 key="hibernate.jdbc.use_streams_for_binary">true
>                 key="hibernate.jdbc.use_get_generated_keys">true
>                
>                8
>                false
>                5
>                
>                
>                
>                
>                 
>                  key="hibernate.bytecode.use_reflection_optimizer">true
>                 key="hibernate.cglib.use_reflection_optimizer">true
>                
>                
>            
>        
>        
>        
>            uk.co.company.product.persistance.hibernate
>        
>    
>     
>     
> 
>
>
>
>
> On 15 December 2010 16:17, Hielke Hoeve [via Apache Wicket] <
> ml-node+3089324-1169388531-201...@n4.nabble.com
>> wrote:
>
>> Hey Adam,
>>
>> This is still a spring error, you need a sessionfactory and
>> transactionfactory and link them together. The opensessioninview filter
>> only
>> opens a transaction if you get this right. The spring forums are filled
>> with
>> examples.
>>
>> Hielke
>> On 15 Dec 2010 16:58, "adam.gibbons" <[hidden 
>> email]>
>> wrote:
>>
>> >
>> >
>> > Ok, I think this is now back to a Wicket question. Start up is ok now.
>> > However when I try and invoke UserServiceImpl.authenticate(){
>> >        final Temp1 temp1 = new Temp1();
>> >        temp1.setValue(userName);
>> >        temp1DAO.save(temp1);
>> >        return testUserService.authenticate(userName, password);
>> > }
>> >
>> > I get the following error through the GUI:
>> >
>> > Method onFormSubmitted of interface
>> > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
>> component
>> > [MarkupContainer [Component id = signInForm]] threw an exception
>> >
>> > Root cause:
>> >
>> > org.hibernate.HibernateException: persist is not valid without active
>> > transaction
>> > at
>> >
>> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
>>
>> > at $Proxy18.persist(Unknown Source)
>> > at
>> >
>> uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
>>
>> > at
>> >
>> uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
>>
>> > at java.lang.reflect.Method.invoke(Method.java:597)
>> > at
>> >
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>>
>> > at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>>
>> > a

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-15 Thread Michael O'Cleirigh
A good way to resolve the spring/hibernate/transactional errors first 
(to separate from the wicket errors) is to create a junit test case that 
bootstraps the spring context (everything except the "wicketapplication" 
bean).  You can verify that your transaction demarcation is correct 
before injecting the service into your wicket form.


Something like this (in Spring 2.5.6):

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
"file:src/test/resources/testContext.xml" }, inheritLocations=true)

@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class})
public class TestSpringServices {

@Autowired
private UserService uService;

@Test
public void testUserService() {

 // this assumes that uService is a transactional proxy 
(@Transactional on the authenticate method) in the implementation.


   User u = uService.authenticate(userName, password);

Assert.notNull (u);



}
...

You need to add the spring-test artifact to get the 
SpringJUnit4ClassRunner class and junit 4.4 to get the annotations 
(Junit 4.7 is not compatible with spring 2.5.6).


Regards,

Mike





You also need to make sure you've set up your transactions properly.
Are you using the @Transactional annotations?

On Wed, Dec 15, 2010 at 11:40 AM, adam.gibbons  wrote:

Hi Hielke,

Thank you for the helpful reply. :) But I think I already have those in my
applicationConext.xml...:



http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:aop="http://www.springframework.org/schema/aop";
xmlns:tx="http://www.springframework.org/schema/tx";
xmlns:context="http://www.springframework.org/schema/context";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
"
default-autowire="byType"
default-lazy-init="false"







classpath*:/application.properties




${jdbc.driver}
${jdbc.url}
${jdbc.username}
${jdbc.password}















${hibernate.dialect}
true
hibernate.format_sql
zen_template
2

pojo
true
true
true
thread
true



true
true

8
false
5




 
 true
true






uk.co.company.product.persistance.hibernate


 
 





On 15 December 2010 16:17, Hielke Hoeve [via Apache Wicket]<
ml-node+3089324-1169388531-201...@n4.nabble.com

wrote:
Hey Adam,

This is still a spring error, you need a sessionfactory and
transactionfactory and link them together. The opensessioninview filter
only
opens a transaction if you get this right. The spring forums are filled
with
examples.

Hielke
On 15 Dec 2010 16:58, "adam.gibbons"<[hidden 
email]>
wrote:



Ok, I think this is now back to a Wicket question. Start up is ok now.
However when I try and invoke UserServiceImpl.authenticate(){
final Temp1 temp1 = new Temp1();
temp1.setValue(userName);
temp1DAO.save(temp1);
return testUserService.authenticate(userName, password);
}

I get the following error through the GUI:

Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at

component

[MarkupContainer [Component id = signInForm]] threw an exception

Root cause:

org.hibernate.HibernateException: persist is not valid without active
transaction
at


org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)


at $Proxy18.persist(Unknown Source)
at


uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)


at


uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)


at java.lang.reflect.Method.invoke(Method.java:597)
at


org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)


at


org.springframework.aop.framework.ReflectiveMethodInvoc

Re: help me please!!! Wicket/Spring/Hibernate configuration woes

2010-12-16 Thread adam.gibbons

Yes, at both the Service and DAO level. It's in the code I posted! :)


On 15 December 2010 20:15, James Carman [via Apache Wicket] <
ml-node+3089806-1760738882-201...@n4.nabble.com
> wrote:

> You also need to make sure you've set up your transactions properly.
> Are you using the @Transactional annotations?
>
> On Wed, Dec 15, 2010 at 11:40 AM, adam.gibbons <[hidden 
> email]>
> wrote:
>
> >
> > Hi Hielke,
> >
> > Thank you for the helpful reply. :) But I think I already have those in
> my
> > applicationConext.xml...:
> >
> >
> > 
> >  >xmlns="http://www.springframework.org/schema/beans";
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >xmlns:aop="http://www.springframework.org/schema/aop";
> >xmlns:tx="http://www.springframework.org/schema/tx";
> >xmlns:context="http://www.springframework.org/schema/context";
> >xsi:schemaLocation="
> >http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >http://www.springframework.org/schema/aop
> > http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> >http://www.springframework.org/schema/tx
> > http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
> >http://www.springframework.org/schema/context
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd
> >"
> >default-autowire="byType"
> >default-lazy-init="false"
> >>
> > > class="uk.co.company.product.presentation.wicket.app.WicketApplication"
> />
> >
> > >
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
> > autowire="byName">
> >
> > > value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
> >
> >
> >classpath*:/application.properties
> >
> >
> >
> > > class="org.springframework.jdbc.datasource.DriverManagerDataSource"
> > autowire="byName">
> > > name="driverClassName">${jdbc.driver}
> >${jdbc.url}
> > name="username">${jdbc.username}
> > name="password">${jdbc.password}
> >
> >
> >
> >
> > > class="org.springframework.orm.hibernate3.HibernateTransactionManager"
> > autowire="byName">
> >
> >
> >
> >
> >
> > >
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
>
> > autowire="byName">
> >
> >
> >
> >
> >${hibernate.dialect}
> >true
> >hibernate.format_sql
>
> >zen_template
> >2
> >
> >pojo
> >true
> >true
> >true
> > > key="hibernate.current_session_context_class">thread
> >true
> >
> >
> >
> > > key="hibernate.jdbc.use_streams_for_binary">true
> > > key="hibernate.jdbc.use_get_generated_keys">true
> >
> >8
> >false
> >5
> >
> >
> >
> >
> > 
> >  > key="hibernate.bytecode.use_reflection_optimizer">true
> > > key="hibernate.cglib.use_reflection_optimizer">true
> >
> >
> >
> >
> >
> >
> >uk.co.company.product.persistance.hibernate
> >
> >
> > 
> > 
> > 
> >
> >
> >
> >
> > On 15 December 2010 16:17, Hielke Hoeve [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> wrote:
> >
> >> Hey Adam,
> >>
> >> This is still a spring error, you need a sessionfactory and
> >> transactionfactory and link them together. The opensessioninview filter
> >> only
> >> opens a transaction if you get this right. The spring forums are filled
> >> with
> >> examples.
> >>
> >> Hielke
> >> On 15 Dec 2010 16:58, "adam.gibbons" <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3089324&i=0>>
> >> wrote:
> >>
> >> >
> >> >
> >> > Ok, I think this is now back to a Wicket question. Start up is ok now.
>
> >> > However when I try and invoke UserServiceImpl.authenticate(){
> >> >final Temp1 temp1 = new Temp1();
> >> >temp1.setValue(userName);
> >> >temp1DAO.save(temp1);
> >> >return testUserService.authenticate(userName, password);
> >> > }
> >> >
> >> > I get the following error through the GUI:
> >> >
> >> > Method onFormSubmitted of interface
> >> > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> >> component
> >> > [MarkupContainer [Component id = signInForm]] threw an exception
> >> >
> >> > Root cause:
> >> >
> >> > org.hibernate.HibernateException: persist is not v