Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>You ever want to run multiple instance of tomcats with the same install base, but tired of copy and setup server.xml file? Attached are couple Groovy scripts that create new server instances, and a tool to quickly setup a new Groovlet webapp.</p> <h1>NewTomcatInstance.groovy</h1> <p>Assume you have installed Tomcat6 or Tomcat5 in /opt/tomcat directory.</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="none" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bm9uZX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ztoy:~/s zemian$ ./NewTomcatInstance.groovy /opt/tomcat mytomcat Create new instance dir /opt/tomcat/instances/mytomcat Create server.xml file with httpPort 8081, httpPort 8081 Create tomcat-user.xml file with manager role user. Create catalina-mytomcat.sh file Create ROOT webapp Create ROOT webapp web.xml Create ROOT webapp index.jsp Done. To Start Server: /opt/tomcat/bin/catalina-mytomcat.sh start To View Browser: http://127.0.0.1:8081 </pre></td></tr></table> <p>Run it again to create another instnace with mytomcat2, and it should configure to port 8082 and so on...</p> <p>Each new server instance will contains a ROOT webapp that list all other webapps for quick links.</p> <p>Also, the server instance is configured with Tomcat manager webapp enabled with a user: admin. If you are in this stage, you ought to know where to look for your password. <img class="emoticon emoticon-smile" data-emoticon-name="smile" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/smile.png" alt="(smile)" title="(smile)" /> </p> <table class="wysiwyg-macro" data-macro-name="warning" data-macro-parameters="title=Security" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3dhcm5pbmc6dGl0bGU9U2VjdXJpdHl9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"> <p>As stated in Tomcat documentation, enabling Tomcat manager is considered a potential security hole as it enable authenticated users to have total control over your webapps. It's enabled in this script for the sake of easy setup and quick management.</p></td></tr></table> <p>To remove a previous installed instance</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="none" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bm9uZX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ztoy:~/s zemian$ ./delete_tomcat_instance.groovy /opt/tomcat mytomcat </pre></td></tr></table> <h2>NewWebapp.groovy</h2> <p>This script will create a new webapp directory structure with all the Groovlet setup ready.</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="none" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6bm9uZX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> ztoy:~/s zemian$ ./NewWebapp.groovy /opt/tomcat/instances/mytomcat/webapps mywebapp Create webapp Copy groovy jar to lib [copy] Copying 1 file to /opt/tomcat/instances/mytomcat/webapps/mywebapp/WEB-INF/lib Create webapp web.xml Create webapp index.gsp Create webapp mysqlreport.groovy Create webapp mysqlreport.gsp Done. </pre></td></tr></table> <p>Start your server and you have a webapp ready to go!</p> <p>The mysqlreport.groovy is a updated version of Andrew Glover's <a class="external-link" href="http://www.ibm.com/developerworks/java/library/j-pg03155/" rel="nofollow">http://www.ibm.com/developerworks/java/library/j-pg03155/</a><br /> And you will need mysql jdbc driver jar copy into mywebapp/WEB-INF/lib to work.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced