Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Arnaud Cordier
Can't deploy multiple portlet with dependencies to the same kernel
April 3, 2013 12:16 AM

Arnaud Cordier

Rank: New Member

Posts: 1

Join Date: March 7, 2013

Recent Posts


It's been a few days since i've got this problem. I need to deploy several portlet into Liferay but these portlet must share the same libraries.

I work with Liferay 6.1 CE GA 2 bundled with Jboss 7.1.1 and a PostgreSQL DB linked to Redmine.

When i launch only one portlet (timesheet.war), with a dependency on entities and kernel (both .jar) with the scope compile, it works perfectly but when i try to launch a new portlet with the same dependencies on entities and kernel, i've got a conflict:
Caused by: java.lang.IllegalArgumentException: JBAS011053: Incompatible conflicting binding at java:global/MyOtherProjectDAO.

I tried something else then, placing entities and kernel in a .ear with others .war inside and each of them would have a dependency on entities and kernel with the scope provided.At first i tought that it worked, but when placing the .ear on the directory jboss/standalone/deployments, the portlet don't seem to be displayed on liferay even when i added <lifecycle<phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener></lifecycle> in faces-config.xml and
<listener> <listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class></listener> in web.xml. I figured out that the portlet must be deployed on a specific directory, /deploy on the same level as the server jboss, to be visible on Liferay.

I tried something else, again, by placing the .jar in the .ear and placing the .ear on the directory /jboss/standalone/deployments and after deploying the .war on /deploy but i got these errors : Caused by: java.lang.NoClassDefFoundError: MyProjectsDAO;
Caused by: java.lang.ClassNotFoundException: myProject.kernel.dao.interfaces.MyProjectsDAO from [Module "deployment.myProject-0.0.1-SNAPSHOT.war:main" from Service Module Loader]

When compiling with mvn clean install, the .war compile when the dependencies are on provided but it seems that when deploying, it can't find them. I asked some of my colleagues to find what is the problem and one of them say that it's a prblem with th class loading.

I tried several things to let .war outside of the .ear see the .jar, like jboss-classloading.xml but it doesn't seem to be working. I searched for solutions on Google for a few a days and it seems like a lot of people have the same problem as me but they haven't been answered yet.

Does somebody already find out what's the solution to this problem ?

Thank you,
Cordier Arnaud

Here is a class from the kernel

The interface
 2package myProject.kernel.dao.interfaces;
 4import myProject.entities.redmine.Projects;
 5import myProject.kernel.dao.genericDAO.GenericDAO;
 7public interface MyProjectDAO extends GenericDAO<Projects, String> {
 8    public Projects getProject(Integer projectId);   

The session
 2package myProject.kernel.dao.session;
 4import javax.ejb.EJB;
 5import javax.ejb.Local;
 6import javax.ejb.Stateless;
 7import javax.ejb.TransactionAttribute;
 8import javax.ejb.TransactionAttributeType;
10import myProject.entities.redmine.Projects;
11import myProject.kernel.dao.abstractEJB.AbstractEJB3DAO;
12import myProject.kernel.dao.interfaces.MyProjectDAO;
16@EJB(name="java:global/MyProjectDAO", beanInterface=MyProjectDAO.class)
18public class MyProjectDAOSession extends AbstractEJB3DAO<Projects, String> implements MyProjectDAO {
20    public Projects getProject(Integer projectId) {
21        return findById(String.valueOf(projectId), true);       
22    }