Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Dennis Nes
"BeanLocator has not been set" after portlet deployment
5 de diciembre de 2009 11:36
Respuesta

Dennis Nes

Ranking: Junior Member

Mensajes: 55

Fecha de incorporación: 23 de septiembre de 2009

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?
Andreas Oberhack
RE: "BeanLocator has not been set" after portlet deployment
5 de diciembre de 2009 15:48
Respuesta

Andreas Oberhack

Ranking: New Member

Mensajes: 9

Fecha de incorporación: 9 de marzo de 2009

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
Ahamed Hasan
RE: "BeanLocator has not been set" after portlet deployment
5 de diciembre de 2009 17:34
Respuesta

Ahamed Hasan

Ranking: Expert

Mensajes: 306

Fecha de incorporación: 13 de abril de 2007

Mensajes recientes

We are also facing the same problem.

Help from someone in Liferay will be appreciated
Andreas Oberhack
RE: "BeanLocator has not been set" after portlet deployment [solved]
6 de diciembre de 2009 1:33
Respuesta

Andreas Oberhack

Ranking: New Member

Mensajes: 9

Fecha de incorporación: 9 de marzo de 2009

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
RE: "BeanLocator has not been set" after portlet deployment [solv
6 de diciembre de 2009 3:54
Respuesta

Dennis Nes

Ranking: Junior Member

Mensajes: 55

Fecha de incorporación: 23 de septiembre de 2009

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
Andreas Oberhack
RE: "BeanLocator has not been set" after portlet deployment [solv
6 de diciembre de 2009 5:18
Respuesta

Andreas Oberhack

Ranking: New Member

Mensajes: 9

Fecha de incorporación: 9 de marzo de 2009

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
lekan side
RE: "BeanLocator has not been set" after portlet deployment
18 de febrero de 2010 2:22
Respuesta

lekan side

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 29 de enero de 2010

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.
Dave Weitzel
RE: "BeanLocator has not been set" after portlet deployment
23 de agosto de 2010 19:38
Respuesta

Dave Weitzel

Ranking: Regular Member

Mensajes: 203

Fecha de incorporación: 18 de noviembre de 2009

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 Hossein Jamali
RE: "BeanLocator has not been set" after portlet deployment
25 de julio de 2011 12:09
Respuesta

Seyed Mohammad Hossein Jamali

Ranking: Junior Member

Mensajes: 77

Fecha de incorporación: 13 de diciembre de 2009

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