user2116896
user2116896

Reputation: 41

package Javax.portlet does not exist

=(Using CentOS distro)=

I am attempting to develop a portlet with Grails (using the liferay-exploded, portlets, and portlets-liferay plugins).

I am following the tutorial on http://grails.org/plugin/portlets , but when I go to generate the portlet views, the following error is displayed:

[localhost test]$ grails generate-portlet-views com.test.first
| Compiling 129 source files.
| Error Compilation error: startup failed:
Compile error during compilation with javac.
/home/portaldev1/.grails/2.2.0/projects/test/plugins/portlets-0.9.2/src/java/org/codehaus/grails/portlets/GrailsDispatcherPortlet.java:5: package javax.portlet does not exist
import javax.portlet.*;
^
/home/portaldev1/.grails/2.2.0/projects/test/plugins/portlets-0.9.2/src/java/org/codehaus/grails/portlets/GrailsDispatcherPortlet.java:10: cannot access javax.portlet.GenericPortlet
class file for javax.portlet.GenericPortlet not found

(These problems continue 68 more times)

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
70 errors


1 error
[localhost test]$

I have referred to google/stack overflow/groovy forums/liferay forums and the only answer I have found for this issue is to add portlet-api-2.0.jar to the CLASSPATH environment variable.

I have tried adding this line to my .bash_profile : "CLASSPATH=/home/portletjar/" and these errors still occur.

I am not using eclipse or any other ide.

Please help me in fixing this! I have also tried compiling java code that uses javax.portlet by manually defining the classpath where the .jar is located (using javac -cp).

Upvotes: 2

Views: 3518

Answers (2)

user2116896
user2116896

Reputation: 41

Adding the portlet-api-2.0 jar to the /lib directory seems to have fixed the problem!

Upvotes: 2

bouquetf
bouquetf

Reputation: 445

How did you install your plugin exactly ? With grails install-plugin xxx ?

Check if you have the dependencies declared in conf/BuildConfig.groovy, in plugins session. It should be some lines like :

  • compile ":portlets-liferay:0.4"

Hope it helps Cheers

Upvotes: 0

Related Questions