cancel
Showing results for 
Search instead for 
Did you mean: 

How to override share pages?

upforsin
Star Collaborator
Star Collaborator

Hello,

I have been following few tutorials about overriding and creating own share pages but none of those works..

I am using Alfresco Community - 6.1.2 on Docker.

The error:

ERROR [alfresco.web.site] [http-nio-8080-exec-3] javax.servlet.ServletException: Could not resolve view with name 'tutorials-login.xml' in servlet with name 'Spring Surf Dispatcher Servlet'

Full stack trace:

my-share_1     | 2019-08-01 14:50:09,396  INFO  [web.site.EditionInterceptor] [http-nio-8080-exec-1] Successfully retrieved license information from Alfresco.
my-share_1 | 2019-08-01 14:50:10,952 WARN [extensions.webscripts.WebTemplateProcessor] [http-nio-8080-exec-1] Unable to find a valid template path for uri: tutorials/tutorials-login.ftl
my-share_1 | 2019-08-01 14:50:10,955 WARN [extensions.webscripts.WebTemplateProcessor] [http-nio-8080-exec-1] Unable to find a valid template path for uri: tutorials/tutorials-login.ftl
my-share_1 | Aug 01, 2019 2:52:54 PM org.apache.catalina.core.StandardWrapperValve invoke
my-share_1 | SEVERE: Servlet.service() for servlet [Spring Surf Dispatcher Servlet] in context with path [/share] threw exception [Could not resolve view with name 'tutorials-login.xml' in servlet with name 'Spring Surf Dispatcher Servlet'] with root cause
my-share_1 | javax.servlet.ServletException: Could not resolve view with name 'tutorials-login.xml' in servlet with name 'Spring Surf Dispatcher Servlet'
my-share_1 | at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1198)
my-share_1 | at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1001)
my-share_1 | at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
my-share_1 | at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:867)
my-share_1 | at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
my-share_1 | at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
my-share_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
my-share_1 | at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
my-share_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.springframework.extensions.webscripts.servlet.SecurityHeadersFilter.doFilter(SecurityHeadersFilter.java:177)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.springframework.extensions.webscripts.servlet.CSRFFilter.doFilter(CSRFFilter.java:356)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:474)
my-share_1 | at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:443)
my-share_1 | at org.springframework.extensions.webscripts.servlet.BeanProxyFilter.doFilter(BeanProxyFilter.java:80)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:81)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
my-share_1 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
my-share_1 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
my-share_1 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
my-share_1 | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
my-share_1 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
my-share_1 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
my-share_1 | at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
my-share_1 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
my-share_1 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
my-share_1 | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
my-share_1 | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
my-share_1 | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
my-share_1 | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
my-share_1 | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
my-share_1 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
my-share_1 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
my-share_1 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
my-share_1 | at java.base/java.lang.Thread.run(Thread.java:834)
my-share_1 |
my-share_1 | 2019-08-01 14:52:55,258 ERROR [alfresco.web.site] [http-nio-8080-exec-3] javax.servlet.ServletException: Could not resolve view with name 'tutorials-login.xml' in servlet with name 'Spring Surf Dispatcher Servlet'
my-share_1 | 2019-08-01 14:52:59,426 WARN [extensions.webscripts.WebTemplateProcessor] [http-nio-8080-exec-4] Unable to find a valid template path for uri: tutorials/tutorials-login.ftl
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
howkymike
Alfresco Developer
1 ACCEPTED ANSWER

abhinavmishra14
World-Class Innovator
World-Class Innovator

Mike Smith It should work if you have followed the exact steps as stated here irrespective of whether you use docker or standalone installation: https://docs.alfresco.com/6.1/tasks/dev-extensions-share-tutorials-override-login-page.html

Can you share the what all files you created and folder/file structure here?

According to your error log, tutorials-login.ftl could not be located. 

You need to create/update files as per the folder/file structure mentioned in the tutorial.

1- Add override config for login under "WebFramework" as stated in the tutorial

<yourShareModule>/src/main/resources/META-INF/share-config-custom.xml

or

<yourShareModule>/src/main/resources/web-extension/share-config-custom.xml 

i.e.

<config evaluator="string-compare" condition="WebFramework" replace="false">
   <web-framework>
      <defaults>
         <page-type>
            <id>login</id>
            <page-instance-id>tutorials-login</page-instance-id>
         </page-type>
      </defaults>
    </web-framework>
</config>

2- Create the referenced page under <yourShareModule>/src/main/resources/alfresco/web-extension/site-data/pages

i.e.

<page>
   <template-instance>tutorials-login</template-instance>
   <authentication>none</authentication>
</page>

3- Create template instance file under <yourShareModule>/src/main/resources/alfresco/web-extension/site-data/template-instances

<template-instance>
   <template-type>tutorials/tutorials-login</template-type>
</template-instance>

4- At last create the template under  <yourShareModule>/src/main/resources/alfresco/web-extension/templates

Note that, if you have template-type as tutorials/tutorials-login for example then, templates folder should also have a subfolder named "tutorials" and "tutorials-login.ftl" should be placed under that subfolder, i.e. templates/tutorials

In this case path will be like : <yourShareModule>/src/main/resources/alfresco/web-extension/templates/tutorials/tutorials-login.ftl 

i.e

<html>
  <head>
   <title>Tutorials Login</title>
  </head>
 <body>
  <h2>Tutorials Login</h2>
   <form id="loginform" accept-charset="UTF-8" method="post" action="${url.context}/page/dologin">
     Username: <input type="text" id="username" name="username"/><br>
     Password: <input type="password" id="password" name="password"/><br>
     <input type="submit" id="btn-login" />
   </form>
  </body>
</html>

If you don't match the path then above error which you are getting is likely.

Here is the screen shot of what you should see when you run share module after making changes:

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

3 REPLIES 3

abhinavmishra14
World-Class Innovator
World-Class Innovator

Mike Smith It should work if you have followed the exact steps as stated here irrespective of whether you use docker or standalone installation: https://docs.alfresco.com/6.1/tasks/dev-extensions-share-tutorials-override-login-page.html

Can you share the what all files you created and folder/file structure here?

According to your error log, tutorials-login.ftl could not be located. 

You need to create/update files as per the folder/file structure mentioned in the tutorial.

1- Add override config for login under "WebFramework" as stated in the tutorial

<yourShareModule>/src/main/resources/META-INF/share-config-custom.xml

or

<yourShareModule>/src/main/resources/web-extension/share-config-custom.xml 

i.e.

<config evaluator="string-compare" condition="WebFramework" replace="false">
   <web-framework>
      <defaults>
         <page-type>
            <id>login</id>
            <page-instance-id>tutorials-login</page-instance-id>
         </page-type>
      </defaults>
    </web-framework>
</config>

2- Create the referenced page under <yourShareModule>/src/main/resources/alfresco/web-extension/site-data/pages

i.e.

<page>
   <template-instance>tutorials-login</template-instance>
   <authentication>none</authentication>
</page>

3- Create template instance file under <yourShareModule>/src/main/resources/alfresco/web-extension/site-data/template-instances

<template-instance>
   <template-type>tutorials/tutorials-login</template-type>
</template-instance>

4- At last create the template under  <yourShareModule>/src/main/resources/alfresco/web-extension/templates

Note that, if you have template-type as tutorials/tutorials-login for example then, templates folder should also have a subfolder named "tutorials" and "tutorials-login.ftl" should be placed under that subfolder, i.e. templates/tutorials

In this case path will be like : <yourShareModule>/src/main/resources/alfresco/web-extension/templates/tutorials/tutorials-login.ftl 

i.e

<html>
  <head>
   <title>Tutorials Login</title>
  </head>
 <body>
  <h2>Tutorials Login</h2>
   <form id="loginform" accept-charset="UTF-8" method="post" action="${url.context}/page/dologin">
     Username: <input type="text" id="username" name="username"/><br>
     Password: <input type="password" id="password" name="password"/><br>
     <input type="submit" id="btn-login" />
   </form>
  </body>
</html>

If you don't match the path then above error which you are getting is likely.

Here is the screen shot of what you should see when you run share module after making changes:

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Oh, I'm so sorry sir. It is working indeed.

I thought all folders should be under site-data and I did not notice that templates must be directly under web-extension.

Anyway, thank you for help!

Regards,

Mike

howkymike
Alfresco Developer

You are most welcome. I am glad it worked for you.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)