6 Replies Latest reply on Sep 18, 2006 2:15 PM by Peter Johnson

    IPC and 2.4GA

    Ross Miller Newbie

      Alright, so i installed the helloworldipc portlet and when i wanted to get rid of it, I deleted the .sar from the deploy dir and then removed the portlet on the admin portlet inside the portal, and now i cant re-hotdeploy it. It says that there is an error. I also cannot go into Instances or Portlets in the admin window.

      So i would like to know how to remove the IPC portlet so the portal does not freak out.

        • 1. Re: IPC and 2.4GA
          Peter Johnson Master

          I don't think this is necessairly related just to IPC portlets. I have noticed that when I remove a war file containing my portlets that the portal doesn't automatically clean up references to that portal. And then all kinds of errors and warnings show up.

          I think that the way to cleanly remove a portlet is:

          1) Remove the portlet windows from all pages.
          2) Delete the portlet instances (might automatically do step 1, I'll have to try this).
          3) Remove the war/sar file.

          I haven't tried this yet (emphasis on "yet", it is on my list of things to try this weekend).

          • 2. Re: IPC and 2.4GA
            Peter Johnson Master

            Aw, not even close! I followed my three steps. But the portlet still shows up in the list under Portlets in the Administration Portlet. Then I deployed my portlet again. No errors, but no portlet window either. Off to the Administration Portlet to create an instance and add a portlet window to a page. No errors while doing that. Then log off and back in and go to that page. Errors galore. So it would appear that there is no way to actually delete a portlet. (Well, if you follow my three steps the portlet will at least not cause problems, at least not until your attempt to deploy it again.)

            However, redeploying an existing portlet seems to work just fine. That is, don't do any steps to remove the portlet. Just change the porlet and its configuration and redeploy (with < if-exists > set to overwrite) and the changes are applied.

            • 3. Re: IPC and 2.4GA
              Ross Miller Newbie

               

              "PeterJ" wrote:
              I don't think this is necessairly related just to IPC portlets. I have noticed that when I remove a war file containing my portlets that the portal doesn't automatically clean up references to that portal. And then all kinds of errors and warnings show up.

              I think that the way to cleanly remove a portlet is:

              1) Remove the portlet windows from all pages.
              2) Delete the portlet instances (might automatically do step 1, I'll have to try this).
              3) Remove the war/sar file.

              I haven't tried this yet (emphasis on "yet", it is on my list of things to try this weekend).


              I have had luck with this, Although it takes a "long" time if you have the IPC portlet (which are actually two portlets) then you have to go though the hassle of removing them from the pages, then removing the instances and THEN removing the war/sar file. I'm not the greatest developer so I'm constantly changing things and this will just add to the overhead.

              I wonder what happened, in CR3 the "hot undeploy" worked like a charm and i loved it.

              • 4. Re: IPC and 2.4GA
                Peter Johnson Master

                You could do what I did. I have an Ant script that resets the database and rebuilds the server configuration and deploys the portal, along we a few other odds and ends. This way I know I am always starting from a clean slate and will not be affected by previous deployments. The script takes about a minute to run, and it another minute for the server to initialize.

                • 5. Re: IPC and 2.4GA
                  Ross Miller Newbie

                  would you mind posting that script? I think that would be most helpful to me at the moment.

                  • 6. Re: IPC and 2.4GA
                    Peter Johnson Master

                    Here is the script, and its supporting files. Before running it:

                    1) Modify the build.properties file to reflect your environment.
                    2) Load the MySQL and PostgreSQL JDBC jar files into your Maven2 repository (or change the script to reference them from elsewhere).
                    3) Use a clean install of JBoss AS, one where the 'default' configuration has never been run, because the script makes a copy of it and thus assumes it has never been used.

                    Then run ant (no targets necessary).

                    build.xml

                    <?xml version="1.0"?>
                    <!--
                     Destroys the current JBoss Portal installation and reinitializes it.
                     Does the following:
                     1) Removes existing portal server configuration (does not remove the
                     entire JBoss AS installation, only the one configuration)
                     2) Wipes out and recreates the database (the portal works off of this data
                     so initializing it is key to trying out different things)
                     3) Creates the portal server configuration based on the "default" server
                     configuration.
                     4) Copies the *-ds.xml and jdbc jar file for the desired database to the
                     portal server configuration.
                     5) Copies the portal sar directory to the portal server configuration's deploy
                     directory.
                    -->
                    <project name="reset" default="reset" basedir=".">
                    
                     <!-- Pick up environment variables to locate the local Maven 2 repository -->
                     <property environment="env" />
                    
                     <!-- Contains properties that change often. -->
                     <property file="build.properties" />
                    
                     <!-- Full directory name of the desired server configuration -->
                     <property name="dir.server"
                     location="${home.jboss}/server/${config.server}"
                     />
                     <property name="dir.deploy" location="${dir.server}/deploy" />
                    
                     <!-- Locations of the JDBC jar files within the local Maven 2 repository -->
                     <condition property="jar.jdbc"
                     value="${env.M2_REPO}/mysql/mysql-connector-java/${jdbc.mysql.version}/mysql-connector-java-${jdbc.mysql.version}.jar"
                     >
                     <equals arg1="mysql" arg2="${database}" />
                     </condition>
                     <condition property="jar.jdbc"
                     value="${env.M2_REPO}/postgresql/postgresql/${jdbc.postgresql.version}/postgresql-${jdbc.postgresql.version}.jar"
                     >
                     <equals arg1="postgresql" arg2="${database}" />
                     </condition>
                    
                     <!-- JDBC drivers for the databases -->
                     <condition property="db.driver" value="com.mysql.jdbc.Driver">
                     <equals arg1="mysql" arg2="${database}" />
                     </condition>
                     <condition property="db.driver" value="org.postgresql.Driver">
                     <equals arg1="postgresql" arg2="${database}" />
                     </condition>
                    
                     <!--
                     JDBC URLs for the databases (not the portal database, rather a global
                     database from which we can create the portal databasae)
                     -->
                     <condition property="db.url"
                     value="jdbc:mysql://localhost:3306/mysql?useServerPrepStmts=false&jdbcCompliantTruncation=false"
                     >
                     <equals arg1="mysql" arg2="${database}" />
                     </condition>
                     <condition property="db.url" value="jdbc:postgresql:postgres">
                     <equals arg1="postgresql" arg2="${database}" />
                     </condition>
                    
                     <!-- Administrator login id for the databases -->
                     <condition property="db.user" value="${db.mysql.user}">
                     <equals arg1="mysql" arg2="${database}" />
                     </condition>
                     <condition property="db.user" value="${db.postgresql.user}">
                     <equals arg1="postgresql" arg2="${database}" />
                     </condition>
                    
                     <!-- Administrator password for the databases -->
                     <condition property="db.password" value="${db.mysql.password}">
                     <equals arg1="mysql" arg2="${database}" />
                     </condition>
                     <condition property="db.password" value="${db.postgresql.password}">
                     <equals arg1="postgresql" arg2="${database}" />
                     </condition>
                    
                    
                     <!-- =================================================================== -->
                     <target description="Removes current portal and creates a new one."
                     name="reset"
                     depends="clean-jboss, init-db, create-config, copy-jdbc, copy-portal, copy-extras, copy-forums"
                     />
                    
                     <!-- =================================================================== -->
                     <target description="Removes the server configuration" name="clean-jboss">
                     <delete dir="${dir.server}" />
                     </target>
                    
                    
                     <!-- =================================================================== -->
                     <target description="Initializes the database, removing old one if needed"
                     name="init-db"
                     >
                     <sql driver="${db.driver}"
                     url="${db.url}"
                     userid="${db.user}"
                     password="${db.password}"
                     onerror="continue"
                     src="${database}.sql"
                     print="true"
                     autocommit="true"
                     >
                     <classpath location="${jar.jdbc}" />
                     </sql>
                     </target>
                    
                    
                     <!-- =================================================================== -->
                     <target description="Creates the desired server configuration"
                     name="create-config"
                     >
                     <copy todir="${dir.server}">
                     <fileset dir="${home.jboss}/server/default" />
                     </copy>
                    
                     <!-- Modified log4j config suppresses Hibernate debug logging -->
                     <copy todir="${dir.server}/conf" file="log4j.xml" overwrite="true" />
                     </target>
                    
                    
                     <!-- =================================================================== -->
                     <target description="Copies the database-related files to the server"
                     name="copy-jdbc"
                     >
                     <copy file="${jar.jdbc}" todir="${dir.server}/lib" verbose="true" />
                     <copy file="portal-${database}-ds.xml" todir="${dir.deploy}" verbose="true">
                     <filterset>
                     <filter token="SERVER" value="${config.server}" />
                     </filterset>
                     </copy>
                     </target>
                    
                     <!-- =================================================================== -->
                     <target description="Deploys the portal sar directory to the server"
                     name="copy-portal"
                     >
                     <copy todir="${dir.deploy}/jboss-portal.sar">
                     <fileset dir="${home.portal}/jboss-portal.sar" />
                     </copy>
                     </target>
                    
                    
                     <!-- =================================================================== -->
                     <target description="Copies various extras to the portal"
                     name="copy-extras"
                     if="portal.extras"
                     >
                     <!-- Replace the login page with a better one -->
                     <copy todir="${dir.deploy}/jboss-portal.sar/portal-server.war"
                     file="login.jsp"
                     overwrite="true"
                     />
                    
                     <!-- Add another theme -->
                     <copy todir="${dir.deploy}/havana_affair.war">
                     <fileset dir="havana_affair.war" />
                     </copy>
                     </target>
                    
                     <!-- =================================================================== -->
                     <target description="Copies the forums portlet to the portal"
                     name="copy-forums"
                     if="portal.forums"
                     >
                     <copy todir="${dir.deploy}" file="${portal.forums}" overwrite="true" />
                     </target>
                    
                    </project>


                    build.properties
                    # Where JBoss Application Server is installed
                    home.jboss=/jboss/portal/jboss-4.0.4.GA
                    
                    # Where JBoss Portal is installed
                    #home.portal=/jboss/portal/source/jboss-portal-2.4/core/output/resources
                    #home.portal=/jboss/portal/jboss-portal-2.4.0-CR3-src/core/output/resources
                    home.portal=/jboss/portal/jboss-portal-2.4.0
                    
                    # The name of the server configuration. Also used as the database name.
                    config.server=portal24
                    
                    # Uncomment to copy various extras:
                    # * improved login page
                    # * havana affair theme
                    #portal.extras=
                    portal.forums=/jboss/portal/source/jboss-portal-2.4/forums/output/lib/portal-forums.ear
                    
                    # Identify the database to use (mysql, postgresql)
                    database=mysql
                    #database=postgresql
                    
                    # The database JDBC versions
                    jdbc.mysql.version=5.0.3
                    jdbc.postgresql.version=8.1-407.jdbc3
                    
                    # Database login information
                    db.mysql.user=root
                    db.mysql.password=XXXXXX
                    db.postgresql.user=postgres
                    db.postgresql.password=XXXXXXX



                    mysql.sql
                    DROP DATABASE ${config.server};
                    CREATE DATABASE ${config.server};
                    GRANT ALL PRIVILEGES ON ${config.server}.* TO 'portal'@'localhost' IDENTIFIED BY 'portalpassword' WITH GRANT OPTION;


                    postgresql.sql
                    DROP DATABASE ${config.server};
                    CREATE USER portal WITH PASSWORD 'portalpassword';
                    CREATE DATABASE ${config.server} WITH OWNER = portal ENCODING = 'UTF8';


                    portal-mysql-ds.xml
                    <?xml version="1.0" encoding="UTF-8"?>
                    <datasources>
                     <local-tx-datasource>
                     <jndi-name>PortalDS</jndi-name>
                     <connection-url>jdbc:mysql://localhost:3306/@SERVER@?useServerPrepStmts=false&jdbcCompliantTruncation=false</connection-url>
                     <driver-class>com.mysql.jdbc.Driver</driver-class>
                     <user-name>portal</user-name>
                     <password>portalpassword</password>
                     </local-tx-datasource>
                    </datasources>


                    portal-postgresql-ds.xml
                    <?xml version="1.0" encoding="UTF-8"?>
                    <datasources>
                     <local-tx-datasource>
                     <jndi-name>PortalDS</jndi-name>
                     <connection-url>jdbc:postgresql:@SERVER@</connection-url>
                     <driver-class>org.postgresql.Driver</driver-class>
                     <user-name>portal</user-name>
                     <password>portalpassword</password>
                     </local-tx-datasource>
                    </datasources>