Foros de discusión

"BeanLocator has not been set" after portlet deployment

Dennis Nes, modificado hace 14 años.

"BeanLocator has not been set" after portlet deployment

Junior Member Mensajes: 55 Fecha de incorporación: 23/09/09 Mensajes recientes
Hi,

I have written a portlet (Netbeans, LR 5.2.3, Glassfish) that uses ServiceBuilder and Hooks. The ServiceBuilder API comes with an imported jar file, so it is not developed directly inside the portet I want to deploy.

When deploying the portlet from Netbeans, everything works fine. But when I want to deploy the war file to another server, there is this "BeanLocator has not been set" error.

Does anyone have an idea?
thumbnail
Andreas Oberhack, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment

New Member Mensajes: 9 Fecha de incorporación: 9/03/09 Mensajes recientes
Hi Dennis,

I'm currently also working on that one :-)

My gues is that service builder is not intended to support separation of persistent classes in a jar and the portlet itself.

If you put alle the persistent classes in the portlet itself all works fine.

I'm just digging a bit more into liferays core code - but maybe one of liferays developers can help?

All the best

Andreas
xaxii.com
thumbnail
Andreas Oberhack, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment [solved]

New Member Mensajes: 9 Fecha de incorporación: 9/03/09 Mensajes recientes
Hi everyone,

I have solved the problem.

Just to be sure that we are on the same page here my requirements:

1) Having all my business services in one "component"
2) Having many portlets using those services out of that "component"

The trick is to build that "component" as an portlet under the context "builder". All generated services generated by service builder will refer to that "builder" context.

Than you have to generate the "api" jar and put that jar in the lib folder of each portlet using those services. (or in tomcat lib/ext folder)

That's it!

I know this is a quite poor description - so if you like I could send the eclipse project so that you can transform the solution to either back to plugin sdk or any other IDE.

I have adopted plugin sdk so that it fits well into eclipse dynamic projects and multi service support. I'm planning to extend this to be fully integrated into eclipse as an eclipse plugin.

Anyone interested?

All the best

Andreas
xaxii.com
Dennis Nes, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment [solv

Junior Member Mensajes: 55 Fecha de incorporación: 23/09/09 Mensajes recientes
Hi Andreas,

thanks for your help.

I think I have already done what you suggest, but I am not sure if I got that right:
1. Create a ServiceBuilder Porlet
2. Take the jar out of it and import it to the portlet that uses the ServiceBuilder in the lib folder
3. The result is, that you have a .war with a ServiceBuilder .jar

That is already working, but only aftter direct deployment out of Netbeans, not with a remote server plugin import.

After you post I have done this (because I did not quite understand waht you mean)
1. Take the ServiceBiulder portlet with a sample input/output and deploy it to a new liferay instance with normal war import. Result: Working! I did this because I thought, that the database layer cannot be initialized with a ServiceBuilder jar lib.
2. But again, my original portlet doesn't work
thumbnail
Andreas Oberhack, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment [solv

New Member Mensajes: 9 Fecha de incorporación: 9/03/09 Mensajes recientes
Hi Dennis,

the problem is that I changed the plugin sdk ant scripts quite a bit to get the things run as smooth as possible in eclipse.

So let me switch back to a pure sdk how-to:

1) create a portlet called "builder". Note: the name "builder" is essential !! This portlet will cover all persistent services you intend to create.
2) create your service xml in the WEB-INF folder of the builder portlet
3) run the build-service target. This will create all classes needed for persistent services.
4) run the war (or the deploy) target and deploy the war to your container
5) check the log for any exception - also check whether the database was created. It will be automatically created by deploying the war.

6) now create a jar file from the "service" folder of the builder portlet.
7) put that jar file in the WEB-INF/lib folder of your portlet which will use the persistent services
8) create a war file of your portlet and deploy it to your container.

Now when your portlet is accessing the persistent services, the xxLocalServiceUtil class in the service api jar will search for the portlet with the name "builder" and retrieve the corresponding beans from the spring application context in the builder portlet. Thats how your portlet can access the persistent service implementation.

If you still get the "BeanLocator has not been set" message means that you didn't deploy a portlet under the "builder" context!

The limitation of the current plugin sdk implementation is that you only can create one service in the builder portlet. To overcome that limitation you need to change folder structure and ant scripts of the plugin sdk. But that might be the next step ... :-)

Hope this helps

Andreas
Xaxii.com
thumbnail
Ahmed Hasan, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment

Expert Mensajes: 306 Fecha de incorporación: 13/04/07 Mensajes recientes
We are also facing the same problem.

Help from someone in Liferay will be appreciated
lekan side, modificado hace 14 años.

RE: "BeanLocator has not been set" after portlet deployment

New Member Mensajes: 6 Fecha de incorporación: 29/01/10 Mensajes recientes
Beanlocator has not been set is a common error in service builder in liferay.Can someone in liferay tell us how to do this once and for all please

Thanks in advance.
thumbnail
Dave Weitzel, modificado hace 13 años.

RE: "BeanLocator has not been set" after portlet deployment

Regular Member Mensajes: 208 Fecha de incorporación: 18/11/09 Mensajes recientes
can I second this!

using 6.0.5 GA3 and doing simple hook project in the IDE with 6.0.5 SDK. (adding field to Calendar event using the 'Liferay In Action' shopping category image example as a guide).

After having to move the service.jar file to tomcat/lib/ext so that the imports of my service inside the view_event.jsp can be resolved I get the "BeanLocator has not been set" message

Something somewhere isn't pointing right - I have a feeling it is the active classpath but not sure how to trace that

Googling the error definitely says that Liferay is the only place that has this problem!
Seyed Mohammad Hosein Jamali, modificado hace 12 años.

RE: "BeanLocator has not been set" after portlet deployment

Junior Member Mensajes: 77 Fecha de incorporación: 13/12/09 Mensajes recientes
Hello All
i think i solved this problem !
When i use MyPortletUtil i have same problem as you but i look inside of generated jar file and i found that there is another class called MyPortletLocalServiceUtil.
Instead of MyPortletUtil try to use MyPortletLocalServiceUtil , i think it can help you.

Thanks
S.M.H.Jamali