Did you check what we have in the doc http://wiki-int.exoplatform.org/pages/viewpage.action?pageId=6520981#HowtoextendmyGateIninstance%3F-Iget%22java.lang.IllegalStateException%3ANopreinittaskscanbeaddedtotheportalcontainer%27portal%27%2Cbecauseithasalreadybeeninitialized.%22whatcanIdotofixit%3F? In you case "starter-gatein.ear" will be "starter.war"

I get "java.lang.IllegalStateException: No pre init tasks can be added to the portal container 'portal', because it has already been initialized." what can I do to fix it?
To fix this issue you need to check if:

* The file starter-gatein.ear has been deployed
* The file starter-gatein.ear is the last ear file to be launched

On Wed, Apr 28, 2010 at 10:36 AM, Vitaly Parfonov <vitaly.parfonov@exoplatform.com> wrote:
Hi, all!
I have a problem with deploy GateIn extension in tomcat.

My steps:
1. I create ideall-extension.war with next web.xml
<web-app>
       <display-name>ideall-extension</display-name>
       <filter>
               <filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
               <filter-class>org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter</filter-class>
       </filter>
       <filter>
               <filter-name>SetCurrentIdentityFilter</filter-name>
               <filter-class>org.exoplatform.services.security.web.SetCurrentIdentityFilter</filter-class>
       </filter>
       <filter>
               <filter-name>RestEncodingFilter</filter-name>
               <filter-class>org.exoplatform.services.rest.servlet.RestEncodingFilter</filter-class>
               <init-param>
                       <param-name>REQUEST_ENCODING</param-name>
                       <param-value>UTF-8</param-value>
               </init-param>
       </filter>
       <filter-mapping>
               <filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
               <url-pattern>/rest/private/*</url-pattern>
       </filter-mapping>
       <filter-mapping>
               <filter-name>SetCurrentIdentityFilter</filter-name>
               <url-pattern>/*</url-pattern>
       </filter-mapping>
       <filter-mapping>
               <filter-name>RestEncodingFilter</filter-name>
               <url-pattern>/rest/*</url-pattern>
       </filter-mapping>
       <!-- END WEBDAV -->
       <!--
               ==================================================================
       -->
       <!--
               LISTENER
       -->
       <!--
               ==================================================================
       -->
       <listener>
               <listener-class>org.exoplatform.container.web.PortalContainerConfigOwner</listener-class>
       </listener>
       <!--
               ==================================================================
       -->
       <!--
               SERVLET
       -->
       <!--
               ==================================================================
       -->
       <servlet>
               <servlet-name>GateInServlet</servlet-name>
               <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
               <load-on-startup>0</load-on-startup>
       </servlet>

       <!-- WEBDAV -->
       <servlet>
               <servlet-name>RestServer</servlet-name>
               <description>eXo - Platform REST Server</description>
               <servlet-class>org.exoplatform.services.rest.servlet.RestServlet</servlet-class>
               <load-on-startup>4</load-on-startup>
       </servlet>

       <!-- END WEBDAV -->

       <!--
               =================================================================
       -->
       <servlet-mapping>
               <servlet-name>GateInServlet</servlet-name>
               <url-pattern>/gateinservlet</url-pattern>
       </servlet-mapping>

       <!-- WEBDAV -->
       <servlet-mapping>
               <servlet-name>RestServer</servlet-name>
               <url-pattern>/rest/private/*</url-pattern>
       </servlet-mapping>
</web-app>

2. Create exo.ideall.extension.config-1.0-SNAPSHOT.jar with next
configuration.xml file
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
       xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
       <external-component-plugins>
               <!-- The full qualified name of the PortalContainerConfig -->
               <target-component>org.exoplatform.container.definition.PortalContainerConfig
               </target-component>
               <component-plugin>
                       <!-- The name of the plugin -->
                       <name>Add PortalContainer Definitions</name>
                       <!--
                               The name of the method to call on the PortalContainerConfig in order
                               to register the PortalContainerDefinitions
                       -->
                       <set-method>registerPlugin</set-method>
                       <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
                       <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin
                       </type>
                       <init-params>
                               <object-param>
                                       <name>portal</name>
                                       <object
                                               type="org.exoplatform.container.definition.PortalContainerDefinition">
                                               <!-- The name of the portal container -->
                                               <field name="name">
                                                       <string>portal</string>
                                               </field>
                                               <!-- The name of the context name of the rest web application -->
                                               <field name="restContextName">
                                                       <string>rest</string>
                                               </field>
                                               <!-- The name of the realm -->
                                               <field name="realmName">
                                                       <string>exo-domain</string>
                                               </field>
                                               <!--
                                                       All the dependencies of the portal container ordered by loading
                                                       priority
                                               -->
                                               <field name="dependencies">
                                                       <collection type="java.util.ArrayList">
                                                               <value>
                                                                       <string>eXoResources</string>
                                                               </value>
                                                               <value>
                                                                       <string>portal</string>
                                                               </value>
                                                               <value>
                                                                       <string>dashboard</string>
                                                               </value>
                                                               <value>
                                                                       <string>exoadmin</string>
                                                               </value>
                                                               <value>
                                                                       <string>eXoGadgets</string>
                                                               </value>
                                                               <value>
                                                                       <string>eXoGadgetServer</string>
                                                               </value>
                                                               <value>
                                                                       <string>rest</string>
                                                               </value>
                                                               <value>
                                                                       <string>web</string>
                                                               </value>
                                                               <value>
                                                                       <string>ideall-extension</string>
                                                               </value>
                                                       </collection>
                                               </field>
                                       </object>
                               </object-param>
                       </init-params>
               </component-plugin>
       </external-component-plugins>
</configuration>

3. Then i run tomcat i get exception
SEVERE: Exception sending context initialized event to listener
instance of class
org.exoplatform.container.web.PortalContainerConfigOwner
java.lang.IllegalStateException: No pre init tasks can be added to the
portal container 'portal', because it has already been initialized.
Check the webapp 'ideall-extension'
<------>at org.exoplatform.container.RootContainer$PortalContainerPreInitTask.onAlreadyExists(RootContainer.java:724)
<------>at org.exoplatform.container.RootContainer.addInitTask(RootContainer.java:542)
<------>at org.exoplatform.container.PortalContainer.addInitTask(PortalContainer.java:387)
<------>at org.exoplatform.container.PortalContainer.addInitTask(PortalContainer.java:361)
<------>at org.exoplatform.container.web.PortalContainerConfigOwner.contextInitialized(PortalContainerConfigOwner.java:57)
<------>at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
<------>at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
<------>at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
<------>at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
<------>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
<------>at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
<------>at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
<------>at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
<------>at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
<------>at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
<------>at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
<------>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
<------>at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
<------>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
<------>at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
<------>at org.apache.catalina.core.StandardService.start(StandardService.java:516)
<------>at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
<------>at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
<------>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<------>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<------>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
<------>at java.lang.reflect.Method.invoke(Method.java:597)
<------>at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
<------>at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

I use GateIn 3.0-GA
Server version: Apache Tomcat/6.0.24
Server built:   January 19 2010 1439
Server number:  6.0.0.0
OS Name:        Linux
OS Version:     2.6.31.12-0.2-desktop
Architecture:   i386
JVM Version:    1.6.0_13-b03
JVM Vendor:     Sun Microsystems Inc.


Please help me. That i do wrong.

--
Best regards,
Vitaly
_______________________________________________
gatein-dev mailing list
gatein-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/gatein-dev



--
Nicolas Filotto
JCR Product Manager
Project Manager
eXo Platform SAS
nicolas.filotto@exoplatform.com
+33 (0)6 31 32 92 19