GauravP
GauravP

Reputation: 81

starting liferay

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?

Upvotes: 2

Views: 1526

Answers (2)

Ashok Goli
Ashok Goli

Reputation: 5183

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.

Upvotes: -1

Prakash K
Prakash K

Reputation: 11698

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:

  1. 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.
  2. 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.
  3. 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.

Upvotes: 6

Related Questions