[Hippo-cms7-user] Allow Site to communicate to repository over vm:// instead of rmi://

Wim Ederveen wim.ederveen at atosorigin.com
Fri Dec 4 14:24:49 CET 2009


Hello Zeljko,

I added the repository.xml in the site.war at the following location.
\WEB-INF\classes\org\hippoecm\repository

Do I need to change the context.xml, because there is still a RMI mentioned
there 
(rmi://localhost:1099/hipporepository)
This is our context.xml in the <tomcat>/conf folder.

<?xml version='1.0' encoding='utf-8'?>
<Context>
	<WatchedResource>WEB-INF/web.xml</WatchedResource>
	<!-- Disable session persistence across Tomcat restarts -->
	<Manager pathname="" />
	<Resource name="jdbc/repositoryDS" auth="Container"
type="javax.sql.DataSource"
		maxActive="20" maxIdle="10" minIdle="2" initialSize="2" maxWait="10000"
		testOnBorrow="true" validationQuery="select 1"
poolPreparedStatements="true"
		username="<username>" password="<password>"
driverClassName="com.mysql.jdbc.Driver"
		url="jdbc:mysql://localhost/hippocms?characterEncoding=utf8" />
	<Parameter name="repository-address"
value="rmi://localhost:1099/hipporepository"
		override="false" />
	<Parameter name="repository-directory" value="/tmp"
		override="false" />
</Context>

This is our cms.war - web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<!--
  * Copyright 2008,2009 Hippo
  *
  * Licensed under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
-->
<web-app id="hippo-ecm">

    <!-- General configuration -->
    <display-name>Hippo ECM WAR package</display-name>
    <description>Hippo ECM WAR package</description>

    <context-param>
        <param-name>repository-address</param-name>
        <param-value>rmi://localhost:1099/hipporepository</param-value>
        <description>The address of the repository</description>
    </context-param>

    <!--Default application-->
    <filter>
        <filter-name>ConcurrentLogin</filter-name>
       
<filter-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginFilter</filter-class>
    </filter>
    <filter>
        <filter-name>CMS</filter-name>
       
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>org.hippoecm.frontend.Main</param-value>
        </init-param>
        <init-param>
            <param-name>filterMappingUrlPattern</param-name>
            <param-value>/*</param-value>
        </init-param>
        <init-param>
            <param-name>configuration</param-name>
            <param-value>deployment</param-value>
        </init-param>
        <init-param>
	        <param-name>repository-address</param-name>
	        <param-value>vm://</param-value>
		    </init-param>
    </filter>

    <!--Builtin console-->
    <filter>
        <filter-name>Console</filter-name>
       
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>org.hippoecm.frontend.Main</param-value>
        </init-param>
        <init-param>
            <param-name>config</param-name>
            <param-value>builtin</param-value>
        </init-param>
        <init-param>
            <param-name>configuration</param-name>
            <param-value>deployment</param-value>
        </init-param>
        <init-param>
          <param-name>repository-address</param-name>
          <param-value>vm://</param-value>
        </init-param>      
    </filter>

    <filter-mapping>
        <filter-name>ConcurrentLogin</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>CMS</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>Console</filter-name>
        <url-pattern>/console/*</url-pattern>
    </filter-mapping>
    
    <listener>
       
<listener-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>StatusServlet</servlet-name>
        <servlet-class>org.hippoecm.repository.StatusServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>LoggingServlet</servlet-name>
       
<servlet-class>org.hippoecm.repository.LoggingServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <!-- Repository -->
    <servlet>
        <servlet-name>Repository</servlet-name>
       
<servlet-class>org.hippoecm.repository.RepositoryServlet</servlet-class>
        <init-param>
            <param-name>repository-directory</param-name>
            <param-value>WEB-INF/storage</param-value>
            <description>The (relative) location where to store
files</description>
        </init-param>
        <init-param>
            <param-name>repository-config</param-name>
            <param-value>repository.xml</param-value>
            <description>The location of the repository configuration file.
Unless the location
            starts with file://, the location is retrieved from within the
application package as
            resource.</description>
        </init-param>
        <load-on-startup>4</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>StatusServlet</servlet-name>
        <url-pattern>/status/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>LoggingServlet</servlet-name>
        <url-pattern>/logging/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>Repository</servlet-name>
        <url-pattern>/repository/*</url-pattern>
    </servlet-mapping>

    <!-- Timeout in minutes -->
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>

	<resource-ref>
		<res-ref-name>jdbc/repositoryDS</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
	
</web-app>

And this is our site.war - web.xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
	<!--
		Copyright 2008 Hippo Licensed under the Apache License, Version 2.0
		(the "License"); you may not use this file except in compliance with
		the License. You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
		applicable law or agreed to in writing, software distributed under the
		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
		CONDITIONS OF ANY KIND, either express or implied. See the License for
		the specific language governing permissions and limitations under the
		License.
	-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	version="2.4"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>Hippo Site Toolkit Container Web Application</display-name>

	<!-- Spring Log4j Web Configuration Init Parameters -->
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:log4j.properties</param-value>
    </context-param>

	<context-param>
		<param-name>log4jRefreshInterval</param-name>
		<param-value>60000</param-value>
	</context-param>

	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>site.webapp.root</param-value>
	</context-param>

    <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
       
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    
    <filter>
        <filter-name>HstVirtualHostsFilter</filter-name>
       
<filter-class>org.hippoecm.hst.container.HstVirtualHostsFilter</filter-class>   
        <init-param>
            <param-name>welcome-page</param-name>
            <param-value>home</param-value>
        </init-param>
        <init-param>
            <param-name>preview-prefix</param-name>
            <param-value>/preview</param-value>
        </init-param>
    </filter>
    
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>HstVirtualHostsFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    
	<!-- Spring Log4j Configuring Listener -->
	<listener>
	
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>HstSiteConfigServlet</servlet-name>
	
<servlet-class>org.hippoecm.hst.site.container.HstSiteConfigServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet>
		<servlet-name>HstContainerServlet</servlet-name>
	
<servlet-class>org.hippoecm.hst.container.HstContainerServlet</servlet-class>
        <!--
        HST Application Context Namespace Prefix.
        This should be unique among multiple HST-based application contexts.
        -->
        <!--
        <init-param>
          <param-name>hstContextNamespace</param-name>
          <param-value>news</param-value>
        </init-param>
        -->
        <!--
        HST-2 based SITE application can define and assemble its own
components by uncommenting the following two init parameters 
        and set the spring configuration files properly. The spring
configuration resources are loaded by the context classloader.
        -->
        <!--
        <init-param>
          <param-name>clientComponentManagerClass</param-name>
         
<param-value>org.hippoecm.hst.component.support.ClientComponentManager</param-value>
        </init-param>
        <init-param>
          <param-name>clientComponentManagerConfigurations</param-name>
          <param-value>/META-INF/client-assembly/*.xml</param-value>
        </init-param>
        -->
		<load-on-startup>2</load-on-startup>
	</servlet>

    <servlet>
        <servlet-name>BinariesServlet</servlet-name>
       
<servlet-class>org.hippoecm.hst.servlet.BinariesServlet</servlet-class>
    	<!-- 
    		If you are not using hippogallery:exampleImageSet you might want to
define your
    		own primaryitem location. If you leave away the primaryitem
altogether, then, when the binary location
    		is not pointing at an actual jcr resource, we'll try to serve the jcr
primaryitem in case this points
    		to a resource. For assets, we'll serve the primay item as there won't
be a hippogallery:picture for an asset
    	 -->
    	<init-param>
    		<param-name>primaryitem</param-name>
    		<param-value>hippogallery:picture</param-value>
    	</init-param>
    </servlet>
  
    <servlet>
        <servlet-name>StaticResourceServlet</servlet-name>
       
<servlet-class>org.hippoecm.hst.servlet.StaticResourceServlet</servlet-class>
    </servlet>
    
    <servlet>
        <servlet-name>YUIResourceServlet</servlet-name>
       
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
        <init-param>
            <param-name>jarPathPrefix</param-name>
            <param-value>/org/onehippo/yui/inc/2.6.0</param-value>
        </init-param>
    </servlet>
    
    <servlet>
        <servlet-name>DojoResourceServlet</servlet-name>
       
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
    </servlet>
    
	<servlet-mapping>
	    <servlet-name>HstContainerServlet</servlet-name>
	    <url-pattern>/preview/*</url-pattern>
	</servlet-mapping>

    <servlet-mapping>
        <servlet-name>HstContainerServlet</servlet-name>
        <url-pattern>/live/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>BinariesServlet</servlet-name>
        <url-pattern>/binaries/*</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>StaticResourceServlet</servlet-name>
        <url-pattern>/staticresource/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>YUIResourceServlet</servlet-name>
        <url-pattern>/javascript/yui/*</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>DojoResourceServlet</servlet-name>
        <url-pattern>/javascript/dojo/*</url-pattern>
    </servlet-mapping>
    
	<!-- The Usual Welcome File List -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

    <error-page>
        <error-code>404</error-code>
        <location>/WEB-INF/jsp/errorpages/ErrorPage404.jsp</location>
    </error-page>
  
    <error-page>
        <error-code>500</error-code>
        <location>/WEB-INF/jsp/errorpages/ErrorPage500.jsp</location>
    </error-page>
  
    <error-page>
       
<exception-type>org.hippoecm.hst.core.container.ContainerNotFoundException</exception-type>
        <location>/WEB-INF/jsp/errorpages/ErrorPage404.jsp</location>
    </error-page>
  
    <error-page>
        <exception-type>java.io.FileNotFoundException</exception-type>
        <location>/WEB-INF/jsp/errorpages/ErrorPage404.jsp</location>
    </error-page>
  
    <error-page>
       
<exception-type>org.hippoecm.hst.core.container.ContainerException</exception-type>
        <location>/WEB-INF/jsp/errorpages/ErrorPage500.jsp</location>
    </error-page>
  
    <error-page>
        <exception-type>Exception</exception-type>
        <location>/WEB-INF/jsp/errorpages/ErrorPage500.jsp</location>
    </error-page>
  
 	<resource-ref>
		<res-ref-name>jdbc/repositoryDS</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
    
</web-app>

And finally our hst-config.properties.

#
#  Copyright 2008 Hippo
#
#  Licensed under the Apache License, Version 2.0 (the  "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS"
#  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

development.mode = false

# To disable trace tool floating pane, uncomment the following line.
#trace.tool.component.class = 

check.repositories.running = false
#default.repository.address = rmi://161.90.61.17:1099/hipporepository
default.repository.address = rmi://localhost:1099/hipporepository
#default.repository.address = vm://
default.repository.user.name = admin
default.repository.password = admin

#writable.repository.address = rmi://161.90.61.17:1099/hipporepository
writable.repository.address = rmi://localhost:1099/hipporepository
#writable.repository.address = vm://
writable.repository.user.name = admin
writable.repository.password = admin

# the global user that should be able to read all configuration and retrieve
all events
#hstconfigreader.repository.address =
rmi://161.90.61.17:1099/hipporepository
hstconfigreader.repository.address = rmi://localhost:1099/hipporepository
#hstconfigreader.repository.address = vm://
hstconfigreader.repository.user.name = admin
hstconfigreader.repository.password = admin

default.sites.name = ivho
preview.repository.entry.path = preview
preview.servlet.path = /preview
live.repository.entry.path = live
live.servlet.path = /live
virtualhosts.repository.path = /hst:virtualhosts
binaries.prefix.path = /binaries

observation.sites.config.node.path = /hst:configuration/hst:configuration

#component.error.page = /WEB-INF/jsp/errorpages/component-error-page.jsp
component.error.page = 


What do we need to change to give the site.war its own repository reference?
and do we need to add dependencies to the site pom?

Gr Wim
-- 
View this message in context: http://n2.nabble.com/Allow-Site-to-communicate-to-repository-over-vm-instead-of-rmi-tp4106896p4112396.html
Sent from the General Discussion / Features / Bugs mailing list archive at Nabble.com.



More information about the Hippo-cms7-user mailing list