Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
[ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 05:23
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 05:59
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 06:37
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 06:40
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 06:56
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 07:00
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 07:27
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 08:06
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 08:12
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 08:40
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 27 juin 2012 09:18
RE: [ServiceBuilder] Context initialization failed. Error creating bean David H Nebinger 27 juin 2012 09:45
RE: [ServiceBuilder] Context initialization failed. Error creating bean Milen Dyankov 27 juin 2012 09:54
RE: [ServiceBuilder] Context initialization failed. Error creating bean G Jerom 29 juin 2012 07:58
RE: [ServiceBuilder] Context initialization failed. Error creating bean Milen Dyankov 29 juin 2012 09:18
G Jerom
[ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 05:23
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

Hi Everyone,

I’m working with liferay 6.0.6 and Service Builder. I create entity AppelFine.
As soon as I am deploying my war made by eclipse in liferay I get the following error:

 1
 2        09:31:48,880 ERROR [ContextLoader:220] Context initialization failed
 3org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.perso.payyourfine.service.AppealFineLocalService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.perso.payyourfine.service.persistence.AppealFinePersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
 4    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
 5    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 6    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 7    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 8    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 9    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
10    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
11    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
12    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
13    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
14    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
15    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
16    at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
17    at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
18    at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
19    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
20    at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
21    at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
22    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
23    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
24    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
25    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
26    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
27    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
28    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
29    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
30    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
31    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
32    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
33    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
34    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
35    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
36    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
37    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
38    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
39    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
40    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
41    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
42    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
43    at java.lang.reflect.Method.invoke(Method.java:597)
44    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
45    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
46Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.perso.payyourfine.service.persistence.AppealFinePersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
47    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
48    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
49    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
50    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
51    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
52    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
53    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
54    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
55    at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:106)
56    at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:148)
57    at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcessor.java:57)
58    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
59    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
60    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
61    ... 41 more
62Caused by: java.lang.ExceptionInInitializerError
63    at com.perso.payyourfine.model.impl.AppealFineModelImpl.<clinit>(AppealFineModelImpl.java:77)
64    at com.perso.payyourfine.service.persistence.AppealFinePersistenceImpl.<clinit>(AppealFinePersistenceImpl.java:72)
65    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
66    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
67    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
68    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
69    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
70    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
71    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
72    ... 54 more
73Caused by: java.lang.NullPointerException
74    at com.liferay.portal.configuration.ConfigurationImpl.getFileName(ConfigurationImpl.java:336)
75    at com.liferay.portal.configuration.ConfigurationImpl.<init>(ConfigurationImpl.java:121)
76    at com.liferay.portal.configuration.ConfigurationImpl.<init>(ConfigurationImpl.java:61)
77    at com.liferay.portal.configuration.ConfigurationFactoryImpl.getConfiguration(ConfigurationFactoryImpl.java:28)
78    at com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil.getConfiguration(ConfigurationFactoryUtil.java:25)
79    at com.liferay.util.service.ServiceProps.<init>(ServiceProps.java:65)
80    at com.liferay.util.service.ServiceProps.<clinit>(ServiceProps.java:69)
81    ... 63 more


Here is my file porlet-spring.xml :
 1<?xml version="1.0" encoding="UTF-8"?>
 2
 3<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" default-destroy-method="destroy" default-init-method="afterPropertiesSet" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 4    <bean id="com.perso.payyourfine.service.AppealFineLocalService" class="com.perso.payyourfine.service.impl.AppealFineLocalServiceImpl" />
 5    <bean id="com.perso.payyourfine.service.AppealFineLocalServiceUtil" class="com.perso.payyourfine.service.AppealFineLocalServiceUtil">
 6        <property name="service" ref="com.perso.payyourfine.service.AppealFineLocalService" />
 7    </bean>
 8    <bean id="com.perso.payyourfine.service.persistence.AppealFinePersistence" class="com.perso.payyourfine.service.persistence.AppealFinePersistenceImpl" parent="basePersistence" />
 9</beans>



In this thread they suggest to add service.properties file into WEB-INF/classes but it’s already done.
LiferayForum

Here is my file service.properties
 1
 2##
 3## Properties Override
 4##
 5
 6    #
 7    # Specify where to get the overridden properties. Updates should not be made
 8    # on this file but on the overridden version of this file.
 9    #
10    include-and-override=service-ext.properties
11
12##
13## Build
14##
15
16    build.namespace=Inventory
17    build.number=205
18    build.date=1340722673179
19    build.auto.upgrade=true
20
21##
22## Spring
23##
24
25    #
26    # Input a list of comma delimited Spring configurations. These will be
27    # loaded after the bean definitions specified in the
28    # portalContextConfigLocation parameter in web.xml.
29    #
30    spring.configs=\
31        WEB-INF/classes/META-INF/base-spring.xml,\
32        \
33        WEB-INF/classes/META-INF/hibernate-spring.xml,\
34        WEB-INF/classes/META-INF/infrastructure-spring.xml,\
35        \
36        WEB-INF/classes/META-INF/cluster-spring.xml,\
37        \
38        WEB-INF/classes/META-INF/portlet-spring.xml,\
39        \
40        WEB-INF/classes/META-INF/dynamic-data-source-spring.xml,\
41        WEB-INF/classes/META-INF/shard-data-source-spring.xml,\
42        \
43        WEB-INF/classes/META-INF/ext-spring.xml
44   
45       


If you need more informations, just ask.
Can somebody help me for this ?
Thanks
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 05:59
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

Add a blank "portlet.properties" file in the docroot/WEB-INF/src directory, rebuild and re-deploy.
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 06:37
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

David H Nebinger:
Add a blank "portlet.properties" file in the docroot/WEB-INF/src directory, rebuild and re-deploy.


Hi,

Thanks for your quick help.
I create a black portlet.properties, rebuild with the ServiceBuilder and redeploy with the .war file.
Unfortunately it doesn't work.
If you need more informations, just ask.

Regards
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 06:40
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

You need to have one in both plugin projects, the plugin hosting the service.xml file and the plugins that are consuming the services provided by that portlet.
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 06:56
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

Thanks for the information.
But i have only one portlet (with one service.xml) inside one lifferay project.
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 07:00
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

Well I can tell you that the NPE is being thrown in getFileName() where it is looking for "portlet.properties" from the classes folder and, when it doesn't find it, the NPE is thrown.

Can you check your deployed war and see if there is indeed a portlet.properties file in the WEB-INF/classes directory?
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 07:27
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

David H Nebinger:
Well I can tell you that the NPE is being thrown in getFileName() where it is looking for "portlet.properties" from the classes folder and, when it doesn't find it, the NPE is thrown.

Can you check your deployed war and see if there is indeed a portlet.properties file in the WEB-INF/classes directory?


I check my deployed war in the WEB-INF/classes directory :
-rw------- 1 www server 0 Jun 27 15:08 portlet.properties

In the same folder where I can find :
-rw------- 1 www server 1101 Jun 27 15:09 service.properties
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 08:06
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

Your service is part of a portlet plugin, and not another type of plugin?
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 08:12
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

David H Nebinger:
Your service is part of a portlet plugin, and not another type of plugin?

Yes. I create a liferay project, then a liferay portelet and finally a service builder for my liferay project. I write some code to create a form for my entity. That's all.
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 08:40
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

Okay, my bad. Plugins using the service (other portlets) need the portlet.properties.

Your portlet is going to be looking for the service.properties file which it is not finding.

Seeing that a previous post is showing unix file permissions, they are only readable by the owner. I'm guessing that the owner of the file and user that you use to start your app server are probably two different users.

Try changing the permissions on service.properties to 644 and see if that fixes the issue...
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 09:18
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

David H Nebinger:
Okay, my bad. Plugins using the service (other portlets) need the portlet.properties.

Your portlet is going to be looking for the service.properties file which it is not finding.

Seeing that a previous post is showing unix file permissions, they are only readable by the owner. I'm guessing that the owner of the file and user that you use to start your app server are probably two different users.

Try changing the permissions on service.properties to 644 and see if that fixes the issue...


I give the 777 permissions for service.properties for the two different locations : WEB-INF/classes & WEB-INF/src but it doesn't work.

Inside service.properties one line caught my attention : include-and-override=service-ext.properties
Where can I find this file ? Because I can't find it.
David H Nebinger
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 09:45
Réponse

David H Nebinger

Rang: Liferay Legend

Publications: 6706

Date d'inscription: 1 septembre 2006

Publications Récentes

service-ext.properties is an optional file that you can use to handle property overrides. It is not required and would not be throwing the exception.

After changing the permissions, you probably have to restart your app server to see if it worked (only when the portlet plugin is initializing will it attempt to read the file).
Milen Dyankov
RE: [ServiceBuilder] Context initialization failed. Error creating bean
27 juin 2012 09:54
Réponse

Milen Dyankov

Rang: Regular Member

Publications: 173

Date d'inscription: 23 septembre 2009

Publications Récentes

G Jerom:

I give the 777 permissions for service.properties for the two different locations : WEB-INF/classes & WEB-INF/src but it doesn't work.

Inside service.properties one line caught my attention : include-and-override=service-ext.properties
Where can I find this file ? Because I can't find it.


Don't worry about service-ext.properties file - its used to extends the config since service.properties gets overwritten every time you run service builder. I assume you are using Liferay IDE to build you project. But have you tried to do the same thing from ant? If not, go to the folder where you have your project and try to run this:
1ant clean build-service war

You can also try to delete the WEB-INF/src/service.properties and let service builder regenerate it (not sure if that works without changes in service.xml so back it up first)
Then deploy the WAR found in <YOUR_PROJECT>/../../dist folder and see if it works.
G Jerom
RE: [ServiceBuilder] Context initialization failed. Error creating bean
29 juin 2012 07:58
Réponse

G Jerom

Rang: New Member

Publications: 8

Date d'inscription: 27 juin 2012

Publications Récentes

@David H Nebinger : I restarted the server but the issue remains the same.
@ Milen Dyankov : With Ant I can clean and build services. But I can't make a war for this issue :
build-css:
Error: Could not find or load main class com.liferay.portal.tools.SassToCssBuilder
It seems that this issues come from liferay 6.0.6 and is fix with liferay 6.1 But I have to use liferay 6.0.6 for my work.
So I export with Eclipse my project after using Ant for clean and build services. But I get the same issue as I explain before (Error creating bean)

For an unknown reason, when I restart the server, I have this line on stdout.log :

Loading file:/tmp/35-payYourFine-portlet/WEB-INF/classes/service.properties

Which mean that the server is trying to get service.properties from the tmp folder.
How can I set the right path ?
Milen Dyankov
RE: [ServiceBuilder] Context initialization failed. Error creating bean
29 juin 2012 09:18
Réponse

Milen Dyankov

Rang: Regular Member

Publications: 173

Date d'inscription: 23 septembre 2009

Publications Récentes

G Jerom:
With Ant I can clean and build services. But I can't make a war for this issue :
build-css:
Error: Could not find or load main class com.liferay.portal.tools.SassToCssBuilder


Are you sure you are using a version of Liferay SDK that matches the version of the portal? Double check the value of app.server.dir property in <SDK_HOME>/build.<YOURNAME>.properties file! You may have different versions of SDK/portal mixed up which is sometimes hard to realize with Eclipse IDE. I personally would try to solve the issues without Liferay IDE and only being sure it works from ant, continue to fix things in Eclipse IDE