Long startup time #

If you use JSONWS, Jonas server may start significantly slowly then usual. That's because Jonas server adds current working path in the classloader paths. JSONWS framework scans for all classes on classpaths. Therefore, if current working path contains many subfolders and files, JSONWS simply needs more time to scan it all.

Solution is simple, just run Jonas from its folder.

Development and Production mode #

By default, Jonas is set to work in development mode. This enables two things: 1) plugins hotdeploy is available, and 2) Jonas will redeploy webapps on every file change - even if you just touch html or jsp file! This is important as some plugins, such as 7cogs theme, add content in the portal application. Therefore, portal will restart after the deploy and that will give some unpredictable results (read: exceptions).

To set Jonas in production mode do the following:  go to jonas.properties and change jonas.development value from true to false. In production mode, hot deployment is not available and Jonas will not monitor webapps for changes.

Alternative deployment method #

By default, Liferay portal and plugins are deployed as exploded folders into JONAS/deploy. To have more control it is possible to install portal using repositories and deployment plan.

1. Move exploded folders to  JONAS/repositories/application.

2. Define repository in the JONAS/conf/initial-repository.xml.:

  <repository id="url-application">
    <type>url</type>
    <url>file:///c:/liferay@git/bundles/jonas-5.2.1/repositories/application</url>
  </repository>

3. Create the deployment plan 'liferay.xml' and put it into JONAS/deploy.

<?xml version="1.0" encoding="UTF-8"?>
<deployment-plan xmlns="..." atomic="false" id="liferay">
    <deployment id="liferay-portal" xsi:type="url:url-deploymentType" repository-ref="url-application">
        <url:resource>liferay-portal.war</url:resource>
    </deployment>
    <deployment id="cas-web" xsi:type="url:url-deploymentType" repository-ref="url-application">
        <url:resource>cas-web.war</url:resource>
    </deployment>
</deployment-plan>

With the deployment plan user can change the default deployment order (alphabetical). See more:http://jonas.ow2.org/JONAS_5_2_0_RC1/doc/doc-en/html/deployment-plans_guide.html

Installing cas-web #

Even default cas.war, built from the source, can not be deployed to the Jonas without further modifications. Here are the steps how to deploy our cas-web plugin:

  • deploy cas-web. Deployment will fail (org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection avalable). Stop Jonas server.
  • go to cas web exploded folder: /bundles/jonas-5.2.1/deploy/cas-web.war
  • Locate: cas-web.war/WEB-INF/lib/cas-server-core-3.3.5.jar. Modify it: remove /META-INF/persistence.xml from it
  • Create WEB-INF/classes/META-INF/persistence.xml with content displayed bellow.

The content of persistence.xml file is:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0">

    <persistence-unit name="CasPersistence" transaction-type="RESOURCE_LOCAL">
         <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
          </properties>
    </persistence-unit>
</persistence>

Note: newer versions of cas.war already has the persistence.xml extracted from the core jar. Moreover, newever persistence.xml contains some additional definitions, be sure not to delete them when adding 'hibernate.dialect' property.

Next, we need to turn on hibernate 3.5 on Jonas (to avoid: java.lang.NoClassDefFoundError: javax/persistence/SharedCacheMode). Do the following:

  • Edit file jonas-5.2.1/conf/jonas.properties and change jonas.service.ejb3.jpa.provider from hibernate to hibernate3.5.
  • Now we need to delete hibernate jar from cas-web; delete file: /jonas-5.2.1/deploy/cas-web.war\/WEB-INF/lib/hibernate-3.2.6.ga.jar
  • Delete all working cache! Simply remove content of folder: jonas-5.2.1/work/webapps/jonas/single

Now start the Jonas server and the deployment of cas-web will be sucesful.

Install mail session factory #

Some plugins require mail session factory to be installed in app server under some JNDI name. For Jonas, this is done with these steps:

1. Enable mail service in \jonas-5.2.1\conf\jonas.properties: just add 'mail' to the jonas.services property.

2. Register mail session factory in the same jonas.properties file, for example:

jonas.service.mail.factories MailSession1

3. Create \jonas-5.2.1\conf\MailSession1.properties file. It defines mail session. For example:

mail.factory.name mailSession_1
mail.factory.type javax.mail.Session
...

Note that jndi name 'mailSession_1' is not a reference name!

4. Create or edit jonas-web.xml in exploded folder of web application:

<?xml version="1.0"?>
<jonas-web-app ...>
<jonas-resource>
     <res-ref-name>mail/MailSession</res-ref-name>
     <jndi-name>mailSession_1</jndi-name>
</jonas-resource>
</jonas-web-app>

That's it. Note that res-ref-name is the actual reference name!

0 Allegati
20037 Visualizzazioni
Media (0 Voti)
La media del punteggio è 0.0 stelle su 5.
Commenti
Commenti Autore Data
The command to run Jonas is "Jonas start"... Sophia Zhang 6 novembre 2011 21.12
And you have to use "Jonas stop" before you... Sophia Zhang 6 novembre 2011 21.18

The command to run Jonas is "Jonas start" behind Jonas bin folder.
Inviato il 06/11/11 21.12.
And you have to use "Jonas stop" before you restart the jonas bundle.
Inviato il 06/11/11 21.18.