cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating site with custom site type (presets)

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi folks,

I have defined the my custom site type in a file named custom-site-presets.xml with this content:


<?xml version='1.0' encoding='UTF-8'?>
<presets>
   <preset id="tacit-knowledge-workgroup-content">
      <components>        
         title
         <component>
            <scope>page</scope>
            <region-id>title</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/title/collaboration-title</url>
         </component>
         navigation
         <component>
            <scope>page</scope>
            <region-id>navigation</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/navigation/collaboration-navigation</url>
         </component>
         dashboard components
         <component>
            <scope>page</scope>
            <region-id>full-width-dashlet</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/dashlets/dynamic-welcome</url>
            <properties>
               <dashboardType>site</dashboardType>
            </properties>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-1-1</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/dashlets/colleagues</url>
            <properties>
               <height>504</height>
            </properties>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-2-1</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/dashlets/docsummary</url>
            <url>/components/dashlets/colleagues</url>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-2-2</region-id>
            <source-id>site/${siteid}/content</source-id>
            <url>/components/dashlets/activityfeed</url>
         <url>/components/dashlets/colleagues</url>
         </component>
      </components>
      <pages>
         <page id="site/${siteid}/content">
            <title>Tacit Knowledge WorkGroup Content</title>
            <title-id>page.workGroupContent.title</title-id>
            <description>Tacit Knowledge WorkGroup's content page</description>
            <description-id>page.workGroupContent.description</description-id>
            <template-instance>dashboard-2-columns-wide-right</template-instance>
            <authentication>user</authentication>
            <properties>
               <sitePages>[{"pageId":"documentlibrary"}]</sitePages>
            </properties>
         </page>
      </pages>
   </preset>
</presets>

I have added the required code in the file create-site.get.js (I have edited the original file deployed by Alfresco Share only for testing purposes, then when it works I'll create the proper extension module) and I'm deploying the XML in a JAR file, placed in the shared/lib directory.

When I create the site, my custom site type appears in the drop-down menu but in the creation process I get this error:


SEVERE: Servlet.service() for servlet [Spring Surf Dispatcher Servlet] in context with path [/share] threw exception [Could not resolve view with name 'site/test/dashboard' in servlet with name 'Spring Surf Dispatcher Servlet'] with root cause
javax.servlet.ServletException: Could not resolve view with name 'site/test/dashboard' in servlet with name 'Spring Surf Dispatcher Servlet'
   at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1029)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:374)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
   at java.lang.Thread.run(Thread.java:722)

2012-11-05 09:35:44,189  ERROR [alfresco.web.site] [http-bio-8080-exec-10] javax.servlet.ServletException: Could not resolve view with name 'site/test/dashboard' in servlet with name 'Spring Surf Dispatcher Servlet'

I have been reading different blogs and articles about how to create custom site types and I believe I'm not missing anything, so does anybody have any idea about what could be wrong?

Thanks in advance.
8 REPLIES 8

erikwinlof
Confirmed Champ
Confirmed Champ
Hi Alejandro,

When you have created your site you will be directed to the "dashboard" page (well actually to a page with a page-id of "site/${siteid}/dashboard").
However there is no such page, because what you have done in your preset file is to create a page called "content" (or "site/${siteid}/content" to be exact).
If you just change all instances of "site/${siteid}/content" in your preset xml file to "site/${siteid}/dashboard" I'm sure it will work.

Cheers, Erik

PS. The text nodes ("title", "navigation", "dashboard components") I assume are comments, if not remove them as well.

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi Alejandro,

When you have created your site you will be directed to the "dashboard" page (well actually to a page with a page-id of "site/${siteid}/dashboard").
However there is no such page, because what you have done in your preset file is to create a page called "content" (or "site/${siteid}/content" to be exact).
If you just change all instances of "site/${siteid}/content" in your preset xml file to "site/${siteid}/dashboard" I'm sure it will work.

Cheers, Erik

PS. The text nodes ("title", "navigation", "dashboard components") I assume are comments, if not remove them as well.

erikwinlof, thanks a lot for your answer.

Yes, your assumptions are correct, "title", "navigation", "dashboard components" were comments and the XML file is not being deployed with such text nodes.

I forgot to mention in my first post that after getting the error for first time, what you suggest is the first thing I tried and it didn't work. Even more, after that I tried to deploy my custom presets file with exactly the same content than the original preset with ID site-dashboard (but with different ID of course), getting the same error as a result Smiley Sad

Any more possible potential issues/mistakes?

Regards.

alejandrogarcia
Champ in-the-making
Champ in-the-making
Well I have just found out that if I place my preset directly in the presets.xml file deployed by Share, it works. So my conclusion is that Share is not recognizing my own custom presets file which includes the preset that I'm trying to define as a site type.

As far as I know as of what I was reading in this post (https://forums.alfresco.com/en/viewtopic.php?f=48&t=44619#p132816), you can define your own presets file/s which name meets the "*presets.xml" pattern, both adding your own preset tags and/or override default presets. Am I wrong with this assumption? Furthermore, as I said in my first post I'm deploying my presets XML within a JAR file in the next path:

alfresco/site-data/presets/my-custom-presets.xml

Any idea about what am I doing wrong?

Thanks.

alejandrogarcia
Champ in-the-making
Champ in-the-making
Great, I have found out one more thing: if I place my "*presets.xml" file in the right path within the web-extension directory it works! Specifically, I'm placing a file named "my-custom-presets.xml" in {$TOMCAT_HOME}/shared/classes/alfresco/web-extension/site-data/presets.

Now the question is, would be possible to deploy custom presets XML files within a JAR or AMP package??

Regards.

erikwinlof
Confirmed Champ
Confirmed Champ
Hi again, glad it got sorted!

Yes since v4.1 its possible to place it as /alfresco/site-data/presets/ *-presets.xml inside a .jar (in ${tomcat-home}/shared/lib).

Cheers, Erik

Note! For other readers, you must use "dashboard" rather than "content" in the code up in the original post.

alejandrogarcia
Champ in-the-making
Champ in-the-making
Yes since v4.1 its possible to place it as /alfresco/site-data/presets/ *-presets.xml inside a .jar (in ${tomcat-home}/shared/lib).

Maybe I didn't explain myself properly. It is working by placing the presets file directly in the web-extension directory rather than within a JAR file. As far as I know it should work with a JAR file the same way that you can include pages or template-instances in it. Why doesn't Alfresco Share detect my presets file when it is deployed within a JAR file? I don't know, it is what I'm trying to find out.

Note! For other readers, you must use "dashboard" rather than "content" in the code up in the original post.
True at all, it doesn't work if you try to use a different URL for the page, it seems it must be always site/${siteid}/dashboard. Somebody corrects me if I'm wrong.

Regards.

alejandrogarcia
Champ in-the-making
Champ in-the-making
It seems I have solved my problem.

I don't know what I was doing wrong, but now I can say that my custom presets file is detected by Alfresco Share after deploying it within a JAR file in the path alfresco/site-data/presets/my-custom-presets.xml. The JAR file is placed in ${tomcat-home}/shared/lib, as said before. This is the content of the custom presets file:


<?xml version='1.0' encoding='UTF-8'?>
<presets>
   <!– Well known preset used to generate the default Collaboration Site dashboard –>
   <preset id="my-site-dashboard">
      <components>        
         <!– title –>
         <component>
            <scope>page</scope>
            <region-id>title</region-id>
            <source-id>site/${siteid}/dashboard</source-id>
            <url>/components/title/collaboration-title</url>
         </component>
         <!– navigation –>
         <component>
            <scope>page</scope>
            <region-id>navigation</region-id>
            <source-id>site/${siteid}/dashboard</source-id>
            <url>/components/navigation/collaboration-navigation</url>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-1-1</region-id>
            <source-id>site/${siteid}/dashboard</source-id>
            <url>/components/dashlets/colleagues</url>
            <properties>
               <height>504</height>
            </properties>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-2-1</region-id>
            <source-id>site/${siteid}/dashboard</source-id>
            <url>/components/dashlets/docsummary</url>
         </component>
         <component>
            <scope>page</scope>
            <region-id>component-2-2</region-id>
            <source-id>site/${siteid}/dashboard</source-id>
            <url>/components/dashlets/activityfeed</url>
         </component>
      </components>
      <pages>
         <page id="site/${siteid}/dashboard">
            <title>Collaboration Site Dashboard</title>
            <title-id>page.siteDashboard.title</title-id>
            <description>Collaboration site's dashboard page</description>
            <description-id>page.siteDashboard.description</description-id>
            <template-instance>dashboard-10-columns-wide-right</template-instance>
            <authentication>user</authentication>
            <properties>
               <sitePages>[{"pageId":"documentlibrary"}]</sitePages>
            </properties>
         </page>
      </pages>
   </preset>
</presets>

As you can see, it is quite similar to the default preset with ID site-dashboard, the difference is that I have removed the welcome component and I'm using a custom template-instance.

I hope it helps others facing a similar issue. By the way, I'm using Alfresco 4.2.b, although it should work on any Alfresco 4.1 or greater.

Thanks for those who helped me.

Regards.

Hi

Thanks for posting your solution here. It helped me alot. I wish i had found this thread 1 day earlier. That would have saved 1 day. 🙂

Just to summarize this solution for future reader.

1. If you put your preset.xml file in <strong>"/alfresco/web-extension/site-data/presets" </strong>then place you .jar into <strong> "{tomcat-share}\webapps\share\WEB-INF\lib" </strong>

2. If you put your preset.xml file in <strong>"/alfresco/site-data/presets" </strong>then place your .jar file into <strong> "{tomcat-share}\shared\lib" </strong>


–sumit

PS : I find alfresco dir structure confusing and overly complex.