[opencms-dev] Development Environment

Jonathan Woods jonathan.woods at scintillance.com
Wed Aug 2 06:17:40 CEST 2006


Eclipse debugging of even a remote OpenCms is actually pretty easy, with a
bit of work at the beginning:

1.  Get control of OpenCms start-up, and ensure that the JVM running Tomcat
is started with the following parameter:

-agentlib:jdwp=transport=dt_socket,server=y,address=5555,suspend=n

where 5555 is an available port number.

2.  In Eclipse, set up a new debug launch configuration (Run/Debug...) named
how you like, and in the 'connection properties' part of the dialogue enter
the host name of the machine running OpenCms and the port number you used
above.

3.  Include the necessary OpenCms JARs in your project's path, and you can
even single-step through OpenCms code while your client browser hangs
waiting for a response from your content managed site.

Step 1 can be a bit of a fiddle in that it means delving into start-up
scripts and the like.  I've found the best way for a sizeable development is
to create your own scripts over which you can have total control.  I've
brought these scripts into the Eclipse environment, where I use Ant to
replace parameterised values.  Here for example is the Tomcat start-up
script (run using su) which includes the agentlib parameter mentioned above:

#!/bin/bash
#

if [ "$1" = "start" ] ; then
	{{runtime.java.home}}/bin/java -server
-Dscintillance.instanceName={{app.name}}-{{runtime.servinghost.primaryname}}
{{runtime.java.localeString}}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file={{runtime.catalina.base}}/conf/logging.prope
rties -Djava.endorsed.dirs={{runtime.tomcat.home}}/common/endorsed
-classpath {{runtime.java.classpath}} -Djava.awt.headless=true
-Dcatalina.home={{runtime.catalina.home}}
-Dcatalina.base={{runtime.catalina.base}}
-Djava.io.tmpdir={{runtime.catalina.base}}/temp
org.apache.catalina.startup.Bootstrap start >>
{{runtime.catalina.base}}/logs/catalina.out 2>&1 &

elif [ "$1" = "debug" ] ; then

	{{runtime.java.home}}/bin/java
-Dscintillance.instanceName={{app.name}}-{{runtime.servinghost.primaryname}}
{{runtime.java.localeString}}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file={{runtime.catalina.base}}/conf/logging.prope
rties
-agentlib:jdwp=transport={{runtime.jpda.transport}},server=y,address={{runti
me.jpda.address}},suspend=n
-Djava.endorsed.dirs={{runtime.tomcat.home}}/common/endorsed -classpath
{{runtime.java.classpath}} -Djava.awt.headless=true
-Dcatalina.home={{runtime.catalina.home}}
-Dcatalina.base={{runtime.catalina.base}}
-Djava.io.tmpdir={{runtime.catalina.base}}/temp
org.apache.catalina.startup.Bootstrap start >>
{{runtime.catalina.base}}/logs/catalina.out 2>&1 &

elif [ "$1" = "stop" ] ; then

	{{runtime.java.home}}/bin/java
-Dscintillance.instanceName={{app.name}}-{{runtime.servinghost.primaryname}}
{{runtime.java.localeString}}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file={{runtime.catalina.base}}/conf/logging.prope
rties -Djava.endorsed.dirs={{runtime.tomcat.home}}/common/endorsed
-classpath {{runtime.java.classpath}} -Djava.awt.headless=true
-Dcatalina.home={{runtime.catalina.home}}
-Dcatalina.base={{runtime.catalina.base}}
-Djava.io.tmpdir={{runtime.catalina.base}}/temp
org.apache.catalina.startup.Bootstrap stop

else

	echo "Usage: $0 start | debug | stop"

fi

Jon

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Joe Desbonnet
Sent: 02 August 2006 01:40
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Development Environment

I also would love to see a HowTo on this also.

Looking at my Eclipse settings I see that under Project Properties -> Java
Build Path, you can specify the output folder for compiled classes. If that
pointed to the WEB-INF/classes of the OpenCms webapps that might work.

I suspect a Tomcat restart will be needed for any changes to take effect.

Joe.


On 8/2/06, Chris Tiernan <CTiernan at salesforce.com> wrote:
> I have found that module development to be a cumbersome process the 
> way I currently have OpenCms installed.  I currently have to develop 
> modules blindly, jar them up, and then install them to see if it I get 
> the desired result.  Obviously, this is not a productive process.  Is 
> there a way that I can setup my environment to run the OpenCms 
> workplace and my modules through Eclipse so I can set breakpoints and 
> step through code?  Is there any documentation or any best practices for
this?
> Thanks in advance.
>
> Best,
> Chris
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list To change 
> your list options, or to unsubscribe from the list, please visit 
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>

_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev





More information about the opencms-dev mailing list