Forums de discussion
Problem with beans - making my new portlet work extremely slowly
Ana I Garcia, modifié il y a 15 années.
Problem with beans - making my new portlet work extremely slowly
New Member Publications: 21 Date d'inscription: 18/07/07 Publications récentes
Hello. I created a new portlet, which connects to an LDAP server. The portlet has several combo boxes, which get filled by fields in the LDAP server, and has a "Send" button which sends an e-mail.
First, I modified the files ext-spring-enterprise.xml and ext-spring-professional.xml in ext\ext-ejb\classes\META-INF:
I created those 2 classes, UserLdapImpl and UserManagerImpl. Basically, the first class selects and filters the fields we need from LDAP. The second class has several lines like this:
The portlet I developed works, but it works extremely slowly, it takes 30 - 40 seconds to show the portlet when I click on the page. I get this message in the log multiple times:
This message has to do with spring when we try to use the userManager bean that we defined in the ext-spring-****.xml files. The log message apparently shows up when we use this code:
The class BeanLocatorUtil is part of the package com.liferay.portal.kernel.bean.
I'm using Liferay 4.2.1 running on Tomcat.
If anyone has any ideas as to why this might be happening, why the portlet takes so long to show up, and what is the problem with the beans, please let me know.
In advance, thanks so much for any help!
Sincerely,
Ana
First, I modified the files ext-spring-enterprise.xml and ext-spring-professional.xml in ext\ext-ejb\classes\META-INF:
<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource" lazy-init="true">
<property name="url" value="***MYURL***" />
<property name="base" value="***MYBASE***" />
<property name="userName" value="***MYUSERNAME***" />
<property name="password" value="***MYPASSWORD" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate" lazy-init="true">
<constructor-arg ref="contextSource" />
</bean>
<bean id="userLdap" class="com.liferay.portlet.cau.ldap.impl.UserLdapImpl" lazy-init="true">
<property name="ldapTemplate" ref="ldapTemplate" />
</bean>
<bean id="userManager" class="com.liferay.portlet.cau.service.impl.UserManagerImpl" lazy-init="true">
<property name="userLdap" ref="userLdap" />
</bean>
I created those 2 classes, UserLdapImpl and UserManagerImpl. Basically, the first class selects and filters the fields we need from LDAP. The second class has several lines like this:
public List<labelvaluebean> getListWorkCenter() {
return userLdap.getListWorkCenter();
}</labelvaluebean>
The portlet I developed works, but it works extremely slowly, it takes 30 - 40 seconds to show the portlet when I click on the page. I get this message in the log multiple times:
WARN [BeanLocatorImpl:48] Cache the reference to userManager for better performance
This message has to do with spring when we try to use the userManager bean that we defined in the ext-spring-****.xml files. The log message apparently shows up when we use this code:
UserManager umgr=(UserManager)BeanLocatorUtil.locate("userManager");
The class BeanLocatorUtil is part of the package com.liferay.portal.kernel.bean.
I'm using Liferay 4.2.1 running on Tomcat.
If anyone has any ideas as to why this might be happening, why the portlet takes so long to show up, and what is the problem with the beans, please let me know.
In advance, thanks so much for any help!
Sincerely,
Ana