I work on liferay.We use one module in our project for liferay theme creation. I use command ant -Ddeploy.war=true which deploys it in the server. The war file gets created in the liferay deploy folder. But when I start the server I do not get any options for login. I do not get any liferay specific options. I get the following server logs
An error occurred at line: 117 in the jsp file: /html/portlet/login/login.jsp
com.alepo.hooks.ConcurrentLoginException cannot be resolved to a type
114: <liferay-ui:error exception="<%= UserLockoutException.class %>" message="this-account-has-been-locked" />
115: <liferay-ui:error exception="<%= UserPasswordException.class %>" message="please-enter-a-valid-password" />
116: <liferay-ui:error exception="<%= UserScreenNameException.class %>" message="please-enter-a-valid-screen-name" />
117: <liferay-ui:error exception="<%= com.alepo.hooks.ConcurrentLoginException.class %>" message="max-sessions-exceeded" />
118:
119: <fieldset class="block-labels">
120: <div class="ctrl-holder">
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:307)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:67)
at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:2669)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
Any Idea about it?
It seems your custom login-hook is messed-up and it is not a problem with the theme.
If you read the error carefully:
An error occurred at line: 117 in the jsp file: /html/portlet/login/login.jsp
com.alepo.hooks.ConcurrentLoginException cannot be resolved to a type
So what is happening is the /html/portlet/login/login.jsp is not able to find the class ConcurrentLoginException which probably resides in your hook, why this is happening is because the way liferay handles class-loading.
In short, there are 3 classloaders:
global (the classes in the servers lib like tomcat/ext/lib like database drivers and portal-service.jar): These classes can be used by and is available to all the plugins context and liferay's context.
Portal classloader (classes in ROOT/WEB-INF/lib like the famous portal-impl.jar): These classes or implementation is available only to Liferay's context.
Portlet / Plugin ClassLoader (loads the classes of our plugins): These are available to our plugins (portlets, hooks etc) and is not available to liferay's modules/context.
So after this short crash-course you may have already known what the problem is, but still I would try to answer this (for points sake :-).
So here it is, since a JSP-hook modifies liferay's JSP and is copied over to the ROOT directory it falls under liferay's context so any custom class created inside a plugin (portlet or hook or themes) would not be available to the JSP, so in this case the login.jsp.
So either don't use that class ;-) inside the JSP or put your exception class (packaged in a jar) in the global path i.e. tomcat/ext/lib so that it is available to the login.jsp.
Here is the verdict from Liferay Staff on a similar issue and another answer which might help drive the concept home and help in the future.
Looks like you haven't imported the ConcurrentLoginException class in your /html/portlet/login/login.jsp
Assuming that the ConcurrentLoginException class is in your project, import the class into the login.jsp by placing the below line at the top in login.jsp :
<%#page import="com.alepo.hooks.ConcurrentLoginException"%>
If ConcurrentLoginException class is not present in your project, then use Prakash's method which is an excellent answer on how to map a dependency.
Related
I have looked everywhere for this bug and I have seen no other issue
Currently I am using Liferay 7.0 and I embedded my portlet in a web content template like so:
<div class ="container-fluid">
<div class ="row">
<div class ="col-md-6 col-sm-6">
<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "barebone") />
<#liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
portletName="foo" />
${freeMarkerPortletPreferences.reset()}
</div>
</div>
</div>
Portlet works fine outside of the freemarker template, however inside it actionRequest button is called but it never enters render function so the buttons I set do nothing.
Is there any special requirement for a portlet to be put inside a freemarker template? Did I forget anything?
It seems that you are embedding by portletName so it can be either:
Instanceable, and then you need to provide its instance ID, as:
instanceId="INSTANCE_ID"
If not, set com.liferay.portlet.instanceable=false
If your portlet is instanceable, an instance ID must be provided; otherwise, you can remove this line. To set your portlet to non-instanceable, set the property com.liferay.portlet.instanceable in the component annotation of your portlet to false.
So I have an action in a portlet "pA" that prints some info based on the logged user, and now I need that info in another portlet "pB". Instead of duplicating the code, I want to access the action of porlet "pA" from "pB". Is that even possible?
Researching I've managed to get to this at the beginning of "pB":
<%# taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<liferay-portlet:actionURL var="name" portletName="pA_WAR_war-of-pA">
<liferay-portlet:param name="view" value="v" />
</liferay-portlet:actionURL>
<h1>URL:: ${name}</h1>
But it generates an url for "pB" instead of "pA" ???
I wouldn't worry so much if this is possible, because it's bad style. If you need the same code in two different portlets, just provide it in a library and use that from both portlets.
A portlet, on the UI layer, should be a closed concept and not have interdependencies with other portlets. A dependency on a common library however is fine.
Basically what I'm trying to do is to be able to add my own "search engine" (based on PHP and Mod_rewrite) to any browser automatically.
Somewhere on the Internet I found that I need to declare a search provider. How can I do this? <link>, manifest or some JavaScript?
A couple of steps. First, create an XML file with the information for the search provider. This is an example for Wikipedia: (Named: Wikipedia.xml)
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Wikipedia</ShortName>
<Description>Wikipedia Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" template="http://en.wikipedia.org/w/index.php?title={searchTerms}" />
</OpenSearchDescription>
Then you need to call the Windows method to add it. I do it with a button element like so but you could call the method how ever you prefer.
<input type="button" value="Add Wikipedia Search Provider" onClick='window.external.AddSearchProvider("Wikipedia.xml");'>
Can any one tell me how can I create the back button in my portlet. Are there any existing tags to create the back button which looks like as shared below.
Solution as mentioned in below post should work.
http://www.liferay.com/en_GB/community/forums/-/message_boards/message/22392288
Liferay uses back URL in many of its default portlets.
For example, You can refer sources for message board portlet - view.jsp, edit_category.jsp
If you use to move from first JSP to second JSP, then backURL should be passed as argument in first JSP and retrieve in second JSP to use inside liferay-ui:header tag.
For example,
<portlet:renderURL var="varURL">
<portlet:param name="mvcPath" value="<second-JSP-URL>"></portlet:param>
<portlet:param name="backURL" value="<%= themeDisplay.getURLCurrent() %>"></portlet:param>
</portlet:renderURL>
Try this instead.
Just use one line and it will direct back to previous URL.(Place this code in second jsp).
<input type=button value=" Back" onClick="javascript: window.history.go(-1)" text-align="right">
I have a Jsp that dynamically needs to get included in entire project as user opens any jsp. i.e. As a user opens a jsp my jsp should automatically gets included.
I have written this in web.xml in Tomcat
<jsp-property-group>
<url-pattern>/webapps/ROOT/html/*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<el-ignored>false</el-ignored>
<scripting-invalid>false</scripting-invalid>
<is-xml>false</is-xml>
<include-prelude>/WEB-INF/jsp/tracker.jsp</include-prelude>
<!-- <include-coda>/template/coda.jspf</include-coda> -->
</jsp-property-group>
I had kept my jsp in tomcat under WEB-INF/jsp/ and i want to include it into every porject as it contains a code that tracks log for user.
Or any other way to make this happen.
Thanks.
There is one more way to include your JSP for the whole portal and i.e. the dockbar.
You can create a hook and include your jsp in the /html/portlet/dockbar/view.jsp using either <jsp:include /> or <liferay-util:include /> or simple <%# include file="" /> (this would be static).
<jsp:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<liferay-util:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<%# include file="/jsp/yourJSPPageToBeIncluded.jsp" />
Note: the path may differ depending on where you will be putting the JSP.
Why I am choosing dockbar is because it is present on all the portal-pages of liferay. This won't work if you are opening a pop-up like configuration pop-up or look-and-feel pop-up or other custom dialog pop-ups since dockbar is not present in the pop-up. For using in pop-ups you would have to override portal_pop_up.vm in your custom-theme and write the code as suggested by #VikasV
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
There are two ways for this.
Simple way is to include your JSP in the Theme. When your Theme is applied to your project, and when Theme is rendered, any pages in your project will render this included JSP.
Code sample below. This has to be placed in vm file(navigation.vm).
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
Here, JSP folder is placed directly inside Theme war.
Other way (tedious one), is to include this JSP in each and every JSP page that you want this to be included.
Use <jsp:include> element for this.
Some references,
Ref1
Ref2