Foren

Primefaces commandButton doesn't respond

Julio Anguita, geändert vor 7 Jahren.

Primefaces commandButton doesn't respond

New Member Beiträge: 4 Beitrittsdatum: 18.08.16 Neueste Beiträge
I'm working in a JSF portlet with Primefaces.

I have a simple form with only a input and a button. It's this:
<!--?xml version="1.0"?-->
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
	
	<h:head>
		<f:view contentType="text/html" />
	</h:head>

	<h:body>
		<h:form>
	 		<div>
	 			<p:inputtext styleClass="input-title" value="#{articuloEdicionController.articulo.nombre}" />
	 		</div>
	 		<div>
	 			<p:commandbutton value="Guardar" actionListener="#{articuloEdicionController.guardar()}" />
	 		</div>
 		</h:form>
	</h:body>
</f:view>


But the button doesn't call to the action, it doesn't do it nothing.

In the liferay-portlet.xml there is the tag: <requires-namespaced-parameters>false</requires-namespaced-parameters>.

And the pom.xml dependencies are this:
<dependency>
			<groupid>commons-fileupload</groupid>
			<artifactid>commons-fileupload</artifactid>
			<version>1.3.1</version>
		</dependency>
		<dependency>
			<groupid>commons-io</groupid>
			<artifactid>commons-io</artifactid>
			<version>2.2</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-bridge-impl</artifactid>
			<version>3.2.4-ga5</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.faces</groupid>
			<artifactid>liferay-faces-portal</artifactid>
			<version>3.2.4-ga5</version>
		</dependency>
		<dependency>
			<groupid>com.liferay.portal</groupid>
			<artifactid>util-java</artifactid>
			<version>${liferay.version}</version>
		</dependency>
		<dependency>
			<groupid>com.sun.faces</groupid>
			<artifactid>jsf-api</artifactid>
			<version>2.1.21</version>
		</dependency>
		<dependency>
			<groupid>com.sun.faces</groupid>
			<artifactid>jsf-impl</artifactid>
			<version>2.1.21</version>
		</dependency>
		<dependency>
			<groupid>javax.el</groupid>
			<artifactid>el-api</artifactid>
			<version>1.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>javax.portlet</groupid>
			<artifactid>portlet-api</artifactid>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupid>org.jboss.seam</groupid>
			<artifactid>jboss-el</artifactid>
			<version>2.0.0.GA</version>
			<exclusions>
				<exclusion>
					<artifactid>el-api</artifactid>
					<groupid>javax.el</groupid>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupid>org.primefaces</groupid>
			<artifactid>primefaces</artifactid>
			<version>3.5</version>
		</dependency>
		<dependency>
		    <groupid>com.liferay.portal</groupid>
		    <artifactid>util-taglib</artifactid>
		    <version>6.2.5</version>
		</dependency>
		<dependency>
			<groupid>log4j</groupid>
			<artifactid>log4j</artifactid>
			<version>1.2.16</version>
			<scope>provided</scope>
		</dependency>


What can it be the cause of the problem?

Thanks.
Julio Anguita, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

New Member Beiträge: 4 Beitrittsdatum: 18.08.16 Neueste Beiträge
I forget to tell it. I'm using Liferay 6.2.
thumbnail
Vernon Singleton, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

Expert Beiträge: 315 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Julio,

Julio AnguitaI forget to tell it. I'm using Liferay 6.2.

I want to help you get to the root of your issue, and so let me first recommend that you use the latest version of Liferay Faces (which is also new for Liferay 6.2) and create a new project from a Maven archetype and then examining the resulting war file for dependencies in WEB-INF/lib. For example:

1. Visit liferayfaces.org and use the dropdown lists to choose your Liferay Version, JSF Version, and Component Suite.

2. Copy/paste the "mvn archetype:generate" command that the website shows you. For example:
$ mvn archetype:generate \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.primefaces.portlet \
  -DarchetypeVersion=3.0.0 \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.primefaces.portlet

3. Build the project:
$ cd com.mycompany.my.primefaces.portlet
$ mvn clean package

4. Examine the resulting war for dependencies in WEB-INF/lib, which should look like this:
$ ls target/com.mycompany.my.primefaces.portlet-1.0-SNAPSHOT/WEB-INF/lib | cat -
com.liferay.faces.bridge.api-4.0.0.jar
com.liferay.faces.bridge.ext-3.0.0.jar
com.liferay.faces.bridge.impl-4.0.0.jar
com.liferay.faces.util-3.0.0.jar
javax.faces-2.2.13.jar
log4j-1.2.14.jar
primefaces-6.0.jar

These are the jars that we recommend that you use moving forward for 6.2.
Also, there is a (tested) PrimeFaces demo portlet which shows the use of a p:commandButton that you might want to take a look at.

Hope that helps,
Vernon
Julio Anguita, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

New Member Beiträge: 4 Beitrittsdatum: 18.08.16 Neueste Beiträge
Hi Verno, thanks for your reply.

I updated my JSF libraries in the JBoss and did what you told me.

Before to put the dependencies in my project, I have tried to deploy the new project in the server.

Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:661) [jsf-impl-2.1.21.jar:2.1.21]
	at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:323) [jsf-impl-2.1.21.jar:2.1.21]
	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:216) [jsf-impl-2.1.21.jar:2.1.21]
	... 8 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) [rt.jar:1.7.0_79]
	at java.util.concurrent.FutureTask.get(FutureTask.java:188) [rt.jar:1.7.0_79]
	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:648) [jsf-impl-2.1.21.jar:2.1.21]
	... 10 more
Caused by: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
	at com.liferay.faces.bridge.ext.mojarra.spi.internal.ConfigurationResourceProviderBase.getResourcesPattern(ConfigurationResourceProviderBase.java:50) [com.liferay.faces.bridge.ext-5.0.0.jar:5.0.0 (Aug 29, 2016 AD)]
	at com.liferay.faces.bridge.ext.mojarra.spi.internal.FacesConfigResourceProviderLiferayImpl.getResources(FacesConfigResourceProviderLiferayImpl.java:39) [com.liferay.faces.bridge.ext-5.0.0.jar:5.0.0 (Aug 29, 2016 AD)]
	at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1178) [jsf-impl-2.1.21.jar:2.1.21]
	at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1147) [jsf-impl-2.1.21.jar:2.1.21]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_79]
	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:639) [jsf-impl-2.1.21.jar:2.1.21]
	... 10 more
Caused by: java.lang.ClassNotFoundException: org.osgi.framework.FrameworkUtil from [Module "deployment.com.mycompany.my.primefaces.war:main" from Service Module Loader]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
	... 16 more


It looks like a problem in the JBoss configuration, but I followed this guide when I configured the server: https://dev.liferay.com/discover/deployment/-/knowledge_base/6-2/installing-liferay-on-jboss-7-1. The only thing that it's not equal now in the server is which I have updated the JSF libraries to the version 2.2.

One detail. The Primefaces example portlet worked fine.

It can be a problem in the server?

Thanks.
thumbnail
Vernon Singleton, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

Expert Beiträge: 315 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Julio,

Julio Anguita:
I updated my JSF libraries in the JBoss and did what you told me.

Well, now we know that you are trying to use Jboss. Thanks for letting us know :-)

Julio Anguita:

Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:661) [jsf-impl-2.1.21.jar:2.1.21]
	at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:323) [jsf-impl-2.1.21.jar:2.1.21]
	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:216) [jsf-impl-2.1.21.jar:2.1.21]
	... 8 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) [rt.jar:1.7.0_79]
...

If you are trying to use JSF 2.2, then you will want to deploy to Jboss Wildfly. We recently tested our JSF 2.2 demos using the JBoss Wildfly bundle that you can download here.

Julio Anguita:
It looks like a problem in the JBoss configuration, but I followed this guide when I configured the server: https://dev.liferay.com/discover/deployment/-/knowledge_base/6-2/installing-liferay-on-jboss-7-1. The only thing that it's not equal now in the server is which I have updated the JSF libraries to the version 2.2.

I would not use those instructions unless I needed to use JBoss 7 for some reason. You will need to decide if you are using JSF 2.2 or 2.1. We are only testing with JSF 2.2 these days. Probably best to use JSF 2.2 and Wildfly, unless there is some reason you cannot.

Julio Anguita:
One detail. The Primefaces example portlet worked fine.

Glad to hear that it is working for you.
Julio Anguita, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

New Member Beiträge: 4 Beitrittsdatum: 18.08.16 Neueste Beiträge
Ok, I tried with Widlfy 10, JSF 2.2 and Primefaces 6.0, with the Maven project generated by the web that you told. But, the error is the same:

java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
thumbnail
Vernon Singleton, geändert vor 7 Jahren.

RE: Primefaces commandButton doesn't respond

Expert Beiträge: 315 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Julio,

Julio AnguitaOk, I tried with Widlfy 10, JSF 2.2 and Primefaces 6.0, with the Maven project generated by the web that you told. But, the error is the same:

java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil

Are you trying this with Liferay 7 now? You said you were using Liferay 6.2 above, just curious.

Anyway, if you are using Liferay 7 you will need to add <scope>provided</scope> to your OSGi core dependency like it is here:
https://github.com/liferay/liferay-faces-portal/blob/master/pom.xml#L826

You will also need to use the dependencies you will find at liferayfaces.org using the portlet that tells you the dependencies you will need for your version of Liferay and JSF.

Hope that helps,
Vernon