File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Bean Management Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Bean Management" Watch "Bean Management" New topic
Author

Bean Management

Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

This question actually involves a couple different technologies in addition to JSF but hopefully this is the best forum to pose it:

I've built a portlet using JSF that is using Hibernate to persist data back to the Liferay Database. I used Liferay's Service Builder to create my persistence classes and bundled them in a .jar which I places in my tomcat/lib/ext folder.

I'm calling the code from my backing bean thus:



And my FeedbackItemLocalServiceImpl addFeebackItem method is written to accept a single String parameter.

I'm getting the following error on the page when I click my form submit button:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil' is defined
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
com.liferay.portal.bean.BeanLocatorImpl.locate(BeanLocatorImpl.java:60)
com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:54)
org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil.getService(FeedbackItemLocalServiceUtil.java:112)
org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil.addFeedbackItem(FeedbackItemLocalServiceUtil.java:103)
org.ea.portal.feedback.backing.FeedbackBacking.submit(FeedbackBacking.java:72)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.el.parser.AstValue.invoke(AstValue.java:172)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:387)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:122)
com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:73)
com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:28)
com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:42)
com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:62)
com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:22)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:153)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)


And the beginning of the stack trace:

SEVERE: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil' is defined
javax.faces.el.EvaluationException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil' is defined
...


So it looks like the EL is trying to find this bean but I don't understand why. It's not a managed bean, the methods in it are all static, and I'm not referencing it in any view code.

Anybody seen this before?


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19

That's not EL. It's the Spring Bean factory.

The way I read it, your FeedBackLocalItemServiceUtil class is asking LifeRay for a bean whose name is "org.ea.portal.feedback.service.FeedbackItemLocalServiceUtil".

While that's legal as a bean name, it's more likely that you have your bean names and class names reversed in one of your Spring configuration definitions.

Adding to the confusion is why a FeedBackLocalItemServiceUtil would be asking a service locator for a bean whose name is "FeedBackLocalItemServiceUtil" (to abbreviate it). Kind of looking for oneself, no?

In any event, it doesn't appear that you've included the source code where the actual failure occurs, so I've had to guess. Although it may ultimately not be the code that's wrong, since it looks more like an issue with the Spring config file. Or annotation, if that's what you're using.


Customer surveys are for companies who didn't pay proper attention to begin with.
Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

Thanks for the ideas, Tim.

The Spring config was auto-generated by the Liferay Service Builder so I haven't looked at it yet, but that sounds like a good place to check. If there's no problem there and I still can't resolve it, I'll post the more relevant source code here.
Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

Well as it turns out my portlet-spring.xml file was in the wrong place. I put it in the folder where it belonged (META-INF) and configured the service.properties file to point to it.

So it seems I've cleared that hurdle, and now I'm facing another, but this is probably the wrong section for it since I don't think it's anything to do with JSF either.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bean Management