掲示板
Custom Servlet in Liferay 5.2.3
11年前 に Alex Belt によって更新されました。
Custom Servlet in Liferay 5.2.3
Junior Member 投稿: 49 参加年月日: 12/10/09 最新の投稿
Hi Everyone,
I've created a servlet that uses some Liferay classes in a plug-in project. I've put the servlet mapping in the plug-in's web.xml as suggested here:
http://issues.liferay.com/browse/LEP-2297
The servlet extends another class which extends HttpServlet, so I took the init() code from the com.liferay.portal.kernel.servlet.PortalDelegateServlet and put it in the custom servlet so it would be registered with the PortalDelegatorServlet. However, whenever I try to reach the servlet from a browser (http://localhost:8080/delegate/servlet-name) as a test that the servlet is reachable, I keep getting this:
I embedded some logging code in the servlet's init() method to verify that it's getting invoked, but the logging code isn't even being executed. At this point I have to conclude that the servlet is not getting registered properly for use. What I don't understand is, why?
I've tried reaching it using a number of different paths, /delegate/servlet-name, /servlet-name, /plugin-name/servlet-name, all with the same result. I know I'm overlooking something obvious, I just can't figure out what it is. Any suggestions?
Thanks,
Alex
I've created a servlet that uses some Liferay classes in a plug-in project. I've put the servlet mapping in the plug-in's web.xml as suggested here:
http://issues.liferay.com/browse/LEP-2297
The servlet extends another class which extends HttpServlet, so I took the init() code from the com.liferay.portal.kernel.servlet.PortalDelegateServlet and put it in the custom servlet so it would be registered with the PortalDelegatorServlet. However, whenever I try to reach the servlet from a browser (http://localhost:8080/delegate/servlet-name) as a test that the servlet is reachable, I keep getting this:
javax.servlet.ServletException: No servlet registred for context servlet-name
com.liferay.portal.kernel.servlet.PortalDelegatorServlet.service(PortalDelegatorServlet.java:89)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:193)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:91)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:271)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
com.liferay.portal.servlet.filters.threadlocalcache.ThreadLocalCacheFilter.processFilter(ThreadLocalCacheFilter.java:55)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:91)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:94)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
I embedded some logging code in the servlet's init() method to verify that it's getting invoked, but the logging code isn't even being executed. At this point I have to conclude that the servlet is not getting registered properly for use. What I don't understand is, why?
I've tried reaching it using a number of different paths, /delegate/servlet-name, /servlet-name, /plugin-name/servlet-name, all with the same result. I know I'm overlooking something obvious, I just can't figure out what it is. Any suggestions?
Thanks,
Alex
11年前 に Alex Belt によって更新されました。
RE: Custom Servlet in Liferay 5.2.3 (回答)
Junior Member 投稿: 49 参加年月日: 12/10/09 最新の投稿
I figured out how to solve the issue. I'm embarassed to say it, it was simple and I completely overlooked it. I created the servlet in a plug-in project and overrode the auth.public.paths in the portal.properties. Servlet access solved.
8年前 に Deepika V によって更新されました。
RE: Custom Servlet in Liferay 5.2.3
Junior Member 投稿: 33 参加年月日: 15/06/16 最新の投稿
Hi Alex,
Even i m facing the same issue. Can you tell me what path u added in portal.properties.
I mean servlet path as
or
it would be very useful if u provide me the answer.
Thanks in advance
Even i m facing the same issue. Can you tell me what path u added in portal.properties.
I mean servlet path as
auth.public.paths = <<hostname>>/portlet-name/servlet-url-mapping
or
auth.public.paths = /servlet-url-mapping
it would be very useful if u provide me the answer.
Thanks in advance