Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
camille vienot
.NoSuchBeanDefinitionException
November 6, 2008 4:13 PM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

Hello,
I have a problem when calling a custom service from Velocity.
Her is how I proceed:
1. I ve created a portlet with SDK
2. create service.xml + ant build-service
3. deploy portlet: it works when called from portlet JSP pages
4. Call the service from a Journal article through Velocity: it does not work

Instead of the journal content, an error message is displayed:

Invocation of method 'findService' in class com.liferay.portal.velocity.ServiceLocator threw exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.liferay.sampleservicebuilder.service.QuoteLocalService.velocity' is defined @ com.liferay.portlet.journal.util.JournalVmUtil[1,43]

I checked in the portlet-spring.xml file and have got the following:
<bean id="com.liferay.sampleservicebuilder.service.QuoteLocalService.velocity" class="org.springframework.aop.framework.ProxyFactoryBean" parent="baseVelocityService">
<property name="target" ref="com.liferay.sampleservicebuilder.service.QuoteLocalService.impl" />
</bean>

My knowledge of spring is not as good as to understand the porblem. Maybe I should use another BeanFactoryClass?
Thank you for reading and suggestions
Camille
camille vienot
RE: .NoSuchBeanDefinitionException
November 6, 2008 3:50 PM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

i had not seen a thread already exist on this issue:
camille vienot
RE: .NoSuchBeanDefinitionException
November 6, 2008 4:12 PM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

Hello again,
I cannot find org.springframework.aop.framework.ProxyFactoryBean class in the spring.jar of the ROOT instance. Maybe this is the reason why the bean is not created. I am trying to point to a new class in the portlet-spring.xml, but I am not sure what class to use.
I was not able to find the class used for the portal services. Anyone has an idea?
Thanks for reading,
Camille
Wilson Man
RE: .NoSuchBeanDefinitionException
November 7, 2008 1:19 AM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 577

Join Date: June 21, 2006

Recent Posts

i'm not seeing this issue with my setup. which version of liferay are you on? (i'm using trunk which is pre 5.2. Also, how are you getting your service in your template?
camille vienot
RE: .NoSuchBeanDefinitionException
November 7, 2008 10:15 AM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

Thank you for replying,
Im using the latest version of trunk. And to call my service from my journal template, i use the following syntax:
#set($QuoteLocalService = $serviceLocator.findService("com.liferay.sampleservicebuilder.service.QuoteLocalService"))

When I call the service from the portlet in which it is defined, it works. But using velocity, it throws a NoSuchBeanDefinitionException because it could not find the com.liferay.sampleservicebuilder.service.QuoteLocalService.bean. However, it is defined and associated to the same java class than the portal services. It must not been loaded at the same time though
I ll keep looking. I may build the service in the ext environment.
Thanks
Wilson Man
RE: .NoSuchBeanDefinitionException
November 7, 2008 1:54 PM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 577

Join Date: June 21, 2006

Recent Posts

that's strange, i'm doing something similar and it's working for me. i'm running tomcat 6, trunk revision 22388. i've deployed trunk to my tomcat 6 instance and my plugins sdk is pointing to the same tomcat for building services. is that your setup?
camille vienot
RE: .NoSuchBeanDefinitionException
November 7, 2008 2:34 PM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

I am running on tomcat 5.5. I am using the tomcat-5.5.26 bundle and did not update trunk. Is there any known issue for this configuration? In the mean time, I tried developing the service using the ext environment. It still does not work because the service found is null but at least, the bean is correctly loaded.
camille vienot
RE: .NoSuchBeanDefinitionException
November 7, 2008 5:00 PM
Answer

camille vienot

Rank: New Member

Posts: 15

Join Date: October 10, 2008

Recent Posts

The service works well when build and deployed using the ext environment, but not using sdk. I will do with it. Thnak you for your concern.
Camille
Jignesh Vachhani
RE: .NoSuchBeanDefinitionException
June 24, 2009 9:35 PM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 780

Join Date: March 10, 2008

Recent Posts

Its working fine for me so thank you so much for sharing your knowledge