Forums de discussion
WAB JSF Portlet - How to acess Liferay APIs?
Gustavo Oliveira, modifié il y a 7 années.
WAB JSF Portlet - How to acess Liferay APIs?
Junior Member Publications: 98 Date d'inscription: 23/09/15 Publications récentes
Im trying to use JournalArticleLocalServiceUtil to migrate data.
pom.xml
Tried a simple test getting an article by Id:
Got this error:
java.lang.ClassCastException: com.sun.proxy.$Proxy464 cannot be cast to com.liferay.journal.service.JournalArticleLocalService
How are you guys doing on JSF Portlets to access Liferay API Utils?
Thanks
pom.xml
<dependency>
<groupid>com.liferay</groupid>
<artifactid>com.liferay.journal.api</artifactid>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>com.liferay.portal</groupid>
<artifactid>com.liferay.portal.kernel</artifactid>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
Tried a simple test getting an article by Id:
JournalArticle article = JournalArticleLocalServiceUtil.getArticle(34002);
System.out.println("Obj: "+article);
Got this error:
java.lang.ClassCastException: com.sun.proxy.$Proxy464 cannot be cast to com.liferay.journal.service.JournalArticleLocalService
How are you guys doing on JSF Portlets to access Liferay API Utils?
Thanks
Juan Gonzalez, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Just like this: https://github.com/liferay/liferay-faces-portal/blob/3.x/demo/portal-showcase-portlet/src/main/java/com/liferay/faces/bridge/demos/util/WebContentUtil.java#L49.
Which Liferay version are you using? Are you using same package as in demo portlet?
Which Liferay version are you using? Are you using same package as in demo portlet?
Gustavo Oliveira, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Junior Member Publications: 98 Date d'inscription: 23/09/15 Publications récentes
Thanks for the fast reply.
Im using the one that came with developer studio and I patched it.
liferay-dxp-digital-enterprise-7.0-ga1
I probably need to add more dependencies, added this one (com.liferay.faces.portal) and now changed the error :
java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User
pom.xml
Im using the one that came with developer studio and I patched it.
liferay-dxp-digital-enterprise-7.0-ga1
I probably need to add more dependencies, added this one (com.liferay.faces.portal) and now changed the error :
java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User
pom.xml
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.journal.api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.portal</artifactId>
<version>2.0.0</version>
</dependency>
Juan Gonzalez, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentesGustavo Oliveira:
java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User
There had been a major refactor of classes and many of them had been moved to com.liferay.portal.kernel.*, so just try: com.liferay.portal.kernel.model.User;
Gustavo Oliveira, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Junior Member Publications: 98 Date d'inscription: 23/09/15 Publications récentes
When I run a fix pack on Liferay Portal it will update the kernel? (This is the last one liferay-fix-pack-de-7-7010.zip)
Thats exactly the problem. Im referring to the new api kernel on pom.xml but my Liferay uses the old one.
Thats exactly the problem. Im referring to the new api kernel on pom.xml but my Liferay uses the old one.
Juan Gonzalez, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentesGustavo Oliveira:
When I run a fix pack on Liferay Portal it will update the kernel? (This is the last one liferay-fix-pack-de-7-7010.zip)
Thats exactly the problem. Im referring to the new api kernel on pom.xml but my Liferay uses the old one.
Yes, it's possible to be changing kernel classes, but those should be Liferay DXP backwards compatible.
The change I mentioned in previous post affects Liferay 6.x to Liferay 7 updates.
Gustavo Oliveira, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Junior Member Publications: 98 Date d'inscription: 23/09/15 Publications récentes
Ive created a new JSF Portlet and copied everything, the only thing that I changed was moving the JournalArticleServiceUtil to an action method instead of invoking it on @PostConstruct method.
It worked
I will paste my pom.xml for anyone that gets the same problem:
It worked
I will paste my pom.xml for anyone that gets the same problem:
<dependencies>
<dependency>
<groupid>commons-fileupload</groupid>
<artifactid>commons-fileupload</artifactid>
<version>1.3.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupid>commons-io</groupid>
<artifactid>commons-io</artifactid>
<version>2.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupid>javax.faces</groupid>
<artifactid>javax.faces-api</artifactid>
<version>${faces.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>org.glassfish</groupid>
<artifactid>javax.faces</artifactid>
<version>${mojarra.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupid>com.liferay.faces</groupid>
<artifactid>com.liferay.faces.bridge.ext</artifactid>
<version>${liferay.faces.bridge.ext.version}</version>
</dependency>
<dependency>
<groupid>com.liferay.faces</groupid>
<artifactid>com.liferay.faces.bridge.impl</artifactid>
<version>${liferay.faces.bridge.version}</version>
</dependency>
<dependency>
<groupid>log4j</groupid>
<artifactid>log4j</artifactid>
<version>1.2.14</version>
</dependency>
<dependency>
<groupid>org.primefaces</groupid>
<artifactid>primefaces</artifactid>
<version>6.0</version>
</dependency>
<dependency>
<groupid>com.liferay.faces</groupid>
<artifactid>com.liferay.faces.alloy</artifactid>
<version>3.0.0</version>
</dependency>
<dependency>
<groupid>mysql</groupid>
<artifactid>mysql-connector-java</artifactid>
<version>5.1.40</version>
</dependency>
<dependency>
<groupid>com.liferay</groupid>
<artifactid>com.liferay.journal.api</artifactid>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>com.liferay.portal</groupid>
<artifactid>com.liferay.portal.kernel</artifactid>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Juan Gonzalez, modifié il y a 7 années.
RE: WAB JSF Portlet - How to acess Liferay APIs?
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentesGustavo Oliveira:
Ive created a new JSF Portlet and copied everything, the only thing that I changed was moving the JournalArticleServiceUtil to an action method instead of invoking it on @PostConstruct method.
It worked
Glad you got it working Gustavo.
We are here for any suggestion/issue you encounter in Liferay Faces and Liferay 7.
Thanks for using Liferay Faces ;-).