Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Newbie to Liferay
Help: ext-spring beans not loaded
May 11, 2008 4:36 PM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

I created a new portlet and added into the liferay framework. It basically retrieves a list of email addresses from the database and send a notification out.

It displays in the right category to add. For some reason, the ext-spring.xml is never loaded. Even I gave a wrong class name, there was no error message when start-up. The class name is supposed to be "EmailEntryServiceFactory" instead of "EmailEntryServiceFactory11".

When I tried to view the content (which triggers XXXEntryServiceFactory._getFactory), it threw the NoSuchBeanDefinitionException exception.

Did I miss anything in order to load ext-spring.xml?

Here is my def in ext-spring.xml. And the spring.configs loading list is not changed or overriden.

1
2    <bean id="com.ext.portlet.sample.service.EmailEntryServiceFactory"
3class="com.ext.portlet.sample.service.EmailEntryServiceFactory11" lazy-init="true">
4        <property name="service">
5            <ref bean="com.ext.portlet.sample.service.EmailEntryService.transaction" />
6        </property>
7    </bean>
Newbie to Liferay
RE: Help: ext-spring beans not loaded
May 19, 2008 11:43 AM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

anybody from the Liferay team could please help me with this?

or at least give me some suggestions?

desparately trying to catch a project deadline
Eric Devlin
RE: Help: ext-spring beans not loaded
May 19, 2008 12:45 PM
Answer

Eric Devlin

Rank: Regular Member

Posts: 154

Join Date: February 19, 2008

Recent Posts

Hey,
Did you try adding the filename to spring.config entry in portal.properties or portal-ext.properties? Make sure that the filename is on the classpath.
Eric
Newbie to Liferay
RE: Help: ext-spring beans not loaded
May 19, 2008 6:36 PM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

Thanks for reply.

I modified the ext-spring.xml file, which is specified last in spring.config in portal.properties.

 1    spring.configs=\
 2        META-INF/activemq-spring-jms.xml,\
 3        META-INF/data-source-spring.xml,\
 4        META-INF/misc-spring.xml,\
 5        META-INF/counter-spring.xml,\
 6        META-INF/documentlibrary-spring.xml,\
 7        META-INF/lock-spring.xml,\
 8        META-INF/mail-spring.xml,\
 9        META-INF/mail-spring-jms.xml,\
10        META-INF/portal-spring.xml,\
11        META-INF/portal-spring-jcr.xml,\
12        META-INF/portal-spring-jms.xml,\
13        [b]META-INF/ext-spring.xml[/b]



META-INF is where the classes will reside.
Newbie to Liferay
RE: Help: ext-spring beans not loaded
May 20, 2008 10:03 AM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

After digging through messages, I finally found http://support.liferay.com/browse/LEP-5693. The 5.0.1 version i am using is affected. Does anyone know if ver5.0.2 is released yet?

If anyone changes the ANT build.xml file and fixes this, can you share the changes? I am using tomcat 5.5.26.

thanks,
Ed F.
RE: Help: ext-spring beans not loaded
May 20, 2008 10:38 AM
Answer

Ed F.

Rank: Expert

Posts: 280

Join Date: June 26, 2006

Recent Posts

I'm not sure how to fix the ant build file, but I've run into this as well.

A temporary, not-too-horrible fix is to add the files yourself to the ext-impl.jar

I am using the extension directory, so not quite sure about the environment if you're not.
After deploying from ext-impl, find ext-impl.jar in ext/ext-impl, open it (I use WinRAR, pretty sure winzip or others can do this as well).

Go inside the meta-inf directory (inside the jar) and "Add" ext-hbm, ext-model-hints, and ext-spring.xml.

Save the jar inside your appserver's lib directory, or wherever the other, deployed ext-impl.jar is.

Then, restart server and it should work.

Unfortunately, you have to check it each time you deploy and make sure the xml files are still there.
Rob Sonke
RE: Help: ext-spring beans not loaded
May 20, 2008 11:07 AM
Answer

Rob Sonke

Rank: Expert

Posts: 275

Join Date: August 26, 2007

Recent Posts

You can check the LEP subversion commits and apply the changes yourself to your local files. I've changed ant file a little so that it copies the xml files also to the right tomcat directory.
Newbie to Liferay
RE: Help: ext-spring beans not loaded
May 20, 2008 11:20 AM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

As Rob suggested, here is what I've changed in the build-parent.xml in the ext-impl folder. Between line 79 to 88.
 1
 2<copy todir="classes">
 3    <fileset dir="src">
 4        <include name="**/dependencies/**" />
 5        <!-- my edits -->
 6        <include name="**/*-ext.properties" />
 7        <include name="**/META-INF/*.xml" />
 8        <!-- my edits -->
 9    </fileset>
10</copy>


After that, I did clean and build the ext environment. I can see ext-hbm, ext-model-hints, and ext-spring.xml being in ext-impl.jar in the tomcat webapps\ROOT\WEB-INF\lib\ folder, and ext-system and ext-portal.properties in the ext-impl\classes folder. I can see ext-*.properties being loaded in the Eclipse console.

But I must done something wrong, because I got a lot of NoClassDefFoundError when starting tomcat .

 1
 218:11:02,763 ERROR [[/]:3639] Exception starting filter Strip Filter
 3java.lang.NoClassDefFoundError
 4    at com.liferay.portal.servlet.filters.strip.StripFilter.<clinit>(StripFilter.java:56)
 5    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 6    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 7    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 8    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
 9    at java.lang.Class.newInstance0(Class.java:350)
10    at java.lang.Class.newInstance(Class.java:303)
11    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:208)
12    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
13    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
14......
1518:11:02,763 ERROR [[/]:3639] Exception starting filter Virtual Host Filter
16java.lang.NoClassDefFoundError
17    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.<clinit>(VirtualHostFilter.java:76)
Newbie to Liferay
RE: Help: ext-spring beans not loaded
May 20, 2008 11:23 AM
Answer

Newbie to Liferay

Rank: New Member

Posts: 10

Join Date: February 21, 2008

Recent Posts

Hi Rob,

Did i add those two lines at the right place? I was trying to follow your suggestion:

"Rob Sonke - 16/Apr/08 02:12 PM
By the way, the fix is quite simple. You can change the copy task in the compile target in the build-parent.xml in the ext-impl dir. Now it only copies the **/dependencies/** but it should copy more. "

----- from http://support.liferay.com/browse/LEP-5693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

thanks,
Rob Sonke
RE: Help: ext-spring beans not loaded
May 21, 2008 4:09 AM
Answer

Rob Sonke

Rank: Expert

Posts: 275

Join Date: August 26, 2007

Recent Posts

Yes that should work.
Benjamin Lallement
RE: Help: ext-spring beans not loaded
May 29, 2008 7:44 AM
Answer

Benjamin Lallement

Rank: New Member

Posts: 8

Join Date: May 13, 2008

Recent Posts

Hi, just to confirm cause i had the same problem.
i've added the two lines in the build-parent.xml and it works !
Tks

Ben
Charanjeet singh Hora
RE: Help: ext-spring beans not loaded
February 18, 2009 5:08 AM
Answer

Charanjeet singh Hora

Rank: New Member

Posts: 24

Join Date: January 20, 2009

Recent Posts

Newbie to Liferay:
Thanks for reply.

I modified the ext-spring.xml file, which is specified last in spring.config in portal.properties.

 1    spring.configs=\
 2        META-INF/activemq-spring-jms.xml,\
 3        META-INF/data-source-spring.xml,\
 4        META-INF/misc-spring.xml,\
 5        META-INF/counter-spring.xml,\
 6        META-INF/documentlibrary-spring.xml,\
 7        META-INF/lock-spring.xml,\
 8        META-INF/mail-spring.xml,\
 9        META-INF/mail-spring-jms.xml,\
10        META-INF/portal-spring.xml,\
11        META-INF/portal-spring-jcr.xml,\
12        META-INF/portal-spring-jms.xml,\
13        [b]META-INF/ext-spring.xml[/b]



META-INF is where the classes will reside.


Hi All,

I am porting my application from lifery 5.1.2 to 5.2.1. My code is generated through service builder. I am facing spring configuration related issues. I have checked entries in ext-spring.xml file for bean definitions of my service which seem fine and wqas working till LR5.1.2. But when I port same code and configuratation files to Lifer4ay 5.2.1 I see that dependency injections which Spring should make are not working.

I am able to access my serviceImpl class through serviceUtil class but from all of my serviceImpl classess I am not able to reach at the next level of services.

I have checked portal.properties for spring.config properties and found entry for ext-spting there.

Please help me to resolve this.

Thanks
-Charanjeet
Rob Sonke
RE: Help: ext-spring beans not loaded
February 19, 2009 7:40 AM
Answer

Rob Sonke

Rank: Expert

Posts: 275

Join Date: August 26, 2007

Recent Posts

Same problem over here, still debugging
Rob Sonke
RE: Help: ext-spring beans not loaded
February 19, 2009 7:56 AM
Answer

Rob Sonke

Rank: Expert

Posts: 275

Join Date: August 26, 2007

Recent Posts

Just found out that when I use the PortalBeanLocatorUtil the problem is solved but when I switch back to the new BeanReference annotation, my beans are not initialized.
Charanjeet singh Hora
RE: Help: ext-spring beans not loaded
February 22, 2009 6:22 AM
Answer

Charanjeet singh Hora

Rank: New Member

Posts: 24

Join Date: January 20, 2009

Recent Posts

thank rob.

I also observed the same problem. when we use PortalBeanLocatorUtil we get a transaction related annotation on service interface.
It solves Hibernate transaction error on service load.
Gunjan Sherathia
RE: Help: ext-spring beans not loaded
February 22, 2009 8:54 PM
Answer

Gunjan Sherathia

Rank: Junior Member

Posts: 48

Join Date: February 20, 2009

Recent Posts

hi

i am new user to liferay. i am developing project management portal.

As u have mention that "I created a new portlet and added into the liferay framework. It basically retrieves a list of email addresses from the database and send a notification out."

can you please tell me how you do this. i am not able to get connection to mysql database. if there is any document or something please suggest me since I am in a urgent need to do it.

please reply me as soon as possible
Charanjeet singh Hora
RE: Help: ext-spring beans not loaded
March 5, 2009 7:53 PM
Answer

Charanjeet singh Hora

Rank: New Member

Posts: 24

Join Date: January 20, 2009

Recent Posts

HI GunJan,

May I know which server, version of liferay you are using?

If you are using 5.2.x then you should configure database settings in portal-ext.properties file. You can see the required db properties in portal.properties file.

If you are using 5.1.x then you should configure the data source in web/application server's resource.
Jose Caro
RE: Help: ext-spring beans not loaded
August 13, 2013 12:10 PM
Answer

Jose Caro

Rank: New Member

Posts: 15

Join Date: November 14, 2012

Recent Posts

Hi everyone,

Have you tried copying the ext-impl.jar file into ...\liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\WEB-INF\lib directory?.
This works for me.

Best regards!.

Ed F.:
I'm not sure how to fix the ant build file, but I've run into this as well.

A temporary, not-too-horrible fix is to add the files yourself to the ext-impl.jar

I am using the extension directory, so not quite sure about the environment if you're not.
After deploying from ext-impl, find ext-impl.jar in ext/ext-impl, open it (I use WinRAR, pretty sure winzip or others can do this as well).

Go inside the meta-inf directory (inside the jar) and "Add" ext-hbm, ext-model-hints, and ext-spring.xml.

Save the jar inside your appserver's lib directory, or wherever the other, deployed ext-impl.jar is.

Then, restart server and it should work.

Unfortunately, you have to check it each time you deploy and make sure the xml files are still there.