Reputation: 873
I created a liferay Hook Plugin, using the hook maven archetype, and have overriden a /html/common/themes/top_js-ext.jspf
. In the jsp i need to use custom functionality, i have in a separate jar. The jar is included via maven dependencies and the project compiles fine, but when i run the jsp the portal cannot find the classes imported.
How can i fix this ? should i manually include the custom jar in the liferay's lib directory ?
If i understood this correctly, the JSP's are executed outside of the Hook Plugin's context, and therefore, the custom classes are not available. Is there a way i can build the plugin, using maven, so that the portal finds my custom jars, without having to move them manually to the portal's classpath ?
Upvotes: 2
Views: 2980
Reputation: 1564
There are multiple options to make your custom jars available for the runtime. First, you could consider putting them into your plugin's WEB-INF/lib directory:
[..] put the JAR file in the WEB-INF/lib folder of your custom-jsps folder [..]
Another approach would be to create an ext plugin and put your jar files either into the ext-lib/portal or into the ext-lib/global directory. Once the deployment of the ext-plugin is done, they will be available to all of your tomcat's webapps (in case of ext-lib/global) or to the portal (which comes as tomcat/webapps/ROOT), respectively.
Upvotes: 2
Reputation: 48057
A JSP is executed in the portal's classloader, even though it's deployed through a separate webapplication (the hook). Thus you have the options to
The drawback for the classloading bridges is that using them feels like programming in reflection - nothing you'd like to routinely do. Especially nothing you'd like to routinely maintain.
Upvotes: 0
Reputation: 31
Take of jar of java class files and place it in root/ web-inf/lib and restart it.
Upvotes: 1