How to set up tomcat for web services which use grails and groovy

312 views
Skip to first unread message

Gerhard Martin

unread,
Nov 18, 2013, 1:42:25 AM11/18/13
to groo...@googlegroups.com
How to set up tomcat for web services which use grails and groovy

Simone Vuong

unread,
Nov 18, 2013, 1:11:29 PM11/18/13
to groo...@googlegroups.com
I would be interested in this information too.

Thanks!


On Mon, Nov 18, 2013 at 12:42 AM, Gerhard Martin <gale...@gmail.com> wrote:
How to set up tomcat for web services which use grails and groovy

--
You received this message because you are subscribed to the "Groovy Users of Minnesota" group.
 
To post to this group, send email to groo...@googlegroups.com
To unsubscribe from this group, send email to groovymn-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/groovymn?hl=en
---
You received this message because you are subscribed to the Google Groups "Groovy Users of Minnesota" group.
To unsubscribe from this group and stop receiving emails from it, send an email to groovymn+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Simone Vuong
Information Technology
Division of Environmental Health Sciences
School of Public Health
University of Minnesota 
Room 350 UOffPI
2719A (Campus Delivery Code)
2221 University Ave SE
Minneapolis, MN 55414


Will Buck

unread,
Nov 18, 2013, 1:39:17 PM11/18/13
to groo...@googlegroups.com, s...@umn.edu, gale...@gmail.com
Hey Gerhard and Simone!

Thanks for asking a question to the group! However, your question is a bit broad in scope to be answered by someone on this list.

Can you be more specific about what is giving you trouble? Deploying a grails application to tomcat isn't all that different from deploying any Java Web application, you simply need to make a war file via the
$grails war
command, then drop your war file into a running tomcat instance's wepapps folder.

Generally speaking, its a good idea to allocate more PermGen memory space for your tomcat servlet, as grails tends to use up more of that part of heap than a standard java app, but otherwise that should get you started.

Did you have any more specific questions someone can help you with?
-Will Buck
Web Developer, Virtuwell

Gerhard Martin

unread,
Nov 18, 2013, 9:14:03 PM11/18/13
to groo...@googlegroups.com
18-Nov-2013 17:36:12.544 INFO [main] org.apache.catalina.core.AprLifecycleListe
er.init Loaded APR based Apache Tomcat Native library 1.1.29 using APR version
.4.8.
18-Nov-2013 17:36:12.545 INFO [main] org.apache.catalina.core.AprLifecycleListe
er.init APR capabilities: IPv6 [true], sendfile [true], accept filters [false],
random [true].
18-Nov-2013 17:36:13.158 INFO [main] org.apache.catalina.core.AprLifecycleListe
er.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013)
18-Nov-2013 17:36:13.234 INFO [main] org.apache.coyote.AbstractProtocol.init In
tializing ProtocolHandler ["http-apr-8081"]
18-Nov-2013 17:36:13.241 INFO [main] org.apache.coyote.AbstractProtocol.init In
tializing ProtocolHandler ["ajp-apr-8009"]
18-Nov-2013 17:36:13.243 INFO [main] org.apache.catalina.startup.Catalina.load
nitialization processed in 882 ms
18-Nov-2013 17:36:13.257 INFO [main] org.apache.catalina.core.StandardService.s
artInternal Starting service Catalina
18-Nov-2013 17:36:13.257 INFO [main] org.apache.catalina.core.StandardEngine.st
rtInternal Starting Servlet Engine: Apache Tomcat/8.0.0-RC5
18-Nov-2013 17:36:13.280 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployWAR Deploying web application archive C:\Users\LAB-User2\Dow
loads\apache-tomcat-8.0.0-RC5\webapps\data-0.8.0.war
2013-11-18 17:36:33,389 [localhost-startStop-1] WARN  util.GrailsUtil  - [DEPRE
ATED] You're using deprecated 'def startDelay = ...; def timeout = ...' paramet
rs in thehk.com.vp.vpfs.services.data.jobs.VpfsJob, use 'static triggers = { si
ple startDelay: ..., repeatInterval: ...} instead.

Configuring Spring Security Core ...
... finished configuring Spring Security Core

Configuring Spring Security LDAP ...
2013-11-18 17:36:57,844 [localhost-startStop-1] ERROR context.ContextLoader  -
ontext initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wi
h name 'messageSource': Initialization of bean failed; nested exception is org.
pringframework.beans.factory.BeanCreationException: Error creating bean with na
e 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while
setting bean property 'sessionFactory'; nested exception is org.springframework
beans.factory.BeanCreationException: Error creating bean with name 'sessionFact
ry': Cannot resolve reference to bean 'hibernateProperties' while setting bean
roperty 'hibernateProperties'; nested exception is org.springframework.beans.fa
tory.BeanCreationException: Error creating bean with name 'hibernateProperties'
 Cannot resolve reference to bean 'dialectDetector' while setting bean property
'properties' with key [hibernate.dialect]; nested exception is org.springframew
rk.beans.factory.BeanCreationException: Error creating bean with name 'dialectD
tector': Invocation of init method failed; nested exception is org.springframew
rk.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaDat
; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Network error IOException: Connection timed out: con
ect)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:4
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor
java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecuto
.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creat
ng bean with name 'transactionManager': Cannot resolve reference to bean 'sessi
nFactory' while setting bean property 'sessionFactory'; nested exception is org
springframework.beans.factory.BeanCreationException: Error creating bean with n
me 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' whi
e setting bean property 'hibernateProperties'; nested exception is org.springfr
mework.beans.factory.BeanCreationException: Error creating bean with name 'hibe
nateProperties': Cannot resolve reference to bean 'dialectDetector' while setti
g bean property 'properties' with key [hibernate.dialect]; nested exception is
rg.springframework.beans.factory.BeanCreationException: Error creating bean wit
 name 'dialectDetector': Invocation of init method failed; nested exception is
rg.springframework.jdbc.support.MetaDataAccessException: Error while extracting
DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedExceptio
: Cannot create PoolableConnectionFactory (Network error IOException: Connectio
 timed out: connect)
        ... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creat
ng bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernate
roperties' while setting bean property 'hibernateProperties'; nested exception
s org.springframework.beans.factory.BeanCreationException: Error creating bean
ith name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetect
r' while setting bean property 'properties' with key [hibernate.dialect]; neste
 exception is org.springframework.beans.factory.BeanCreationException: Error cr
ating bean with name 'dialectDetector': Invocation of init method failed; neste
 exception is org.springframework.jdbc.support.MetaDataAccessException: Error w
ile extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQ
NestedException: Cannot create PoolableConnectionFactory (Network error IOExcep
ion: Connection timed out: connect)
        ... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creat
ng bean with name 'hibernateProperties': Cannot resolve reference to bean 'dial
ctDetector' while setting bean property 'properties' with key [hibernate.dialec
]; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dialectDetector': Invocation of init method fail
d; nested exception is org.springframework.jdbc.support.MetaDataAccessException
 Error while extracting DatabaseMetaData; nested exception is org.apache.common
.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network erro
 IOException: Connection timed out: connect)
        ... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creat
ng bean with name 'dialectDetector': Invocation of init method failed; nested e
ception is org.springframework.jdbc.support.MetaDataAccessException: Error whil
 extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNe
tedException: Cannot create PoolableConnectionFactory (Network error IOExceptio
: Connection timed out: connect)
        ... 5 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error whil
 extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNe
tedException: Cannot create PoolableConnectionFactory (Network error IOExceptio
: Connection timed out: connect)
        ... 5 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableCo
nectionFactory (Network error IOException: Connection timed out: connect)
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFact
ry(BasicDataSource.java:1549)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
rce.java:1388)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSourc
.java:1044)
        at com.sun.proxy.$Proxy37.getMetaData(Unknown Source)
        ... 5 more
Caused by: java.sql.SQLException: Network error IOException: Connection timed o
t: connect
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.jav
:395)
        at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.jav
:50)
        at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(Dri
erConnectionFactory.java:38)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolabl
ConnectionFactory.java:582)
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Ba
icDataSource.java:1556)
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFact
ry(BasicDataSource.java:1545)
        ... 8 more
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocket
mpl.java:79)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.j
va:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocke
Impl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.jav
:182)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSo
ket.java:305)
        at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:255)
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.jav
:323)
        ... 14 more
18-Nov-2013 17:36:57.850 SEVERE [localhost-startStop-1] org.apache.catalina.cor
.StandardContext.startInternal Error listenerStart
18-Nov-2013 17:36:57.855 SEVERE [localhost-startStop-1] org.apache.catalina.cor
.StandardContext.startInternal Context [/data-0.8.0] startup failed due to prev
ous errors
18-Nov-2013 17:36:57.881 SEVERE [localhost-startStop-1] org.apache.catalina.loa
er.WebappClassLoader.clearReferencesJdbc The web application [/data-0.8.0] regi
tered the JDBC driver [net.sourceforge.jtds.jdbc.Driver] but failed to unregist
r it when the web application was stopped. To prevent a memory leak, the JDBC D
iver has been forcibly unregistered.
18-Nov-2013 17:36:57.882 SEVERE [localhost-startStop-1] org.apache.catalina.loa
er.WebappClassLoader.clearReferencesThreads The web application [/data-0.8.0] a
pears to have started a thread named [Camel Thread 0 - ShutdownTask] but has fa
led to stop it. This is very likely to create a memory leak.
18-Nov-2013 17:36:57.883 SEVERE [localhost-startStop-1] org.apache.catalina.loa
er.WebappClassLoader.checkThreadLocalMapForLeaks The web application [/data-0.8
0] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1]
value [com.sun.xml.bind.v2.ClassFactory$1@40ef68]) and a value of type [java.ut
l.WeakHashMap] (value [{class javax.xml.bind.annotation.adapters.CollapsedStrin
Adapter=java.lang.ref.WeakReference@125cd64, class org.apache.camel.spring.Came
ContextFactoryBean=java.lang.ref.WeakReference@cf962a, class org.apache.camel.m
del.RouteBuilderDefinition=java.lang.ref.WeakReference@8bb86f, class org.apache
camel.spring.CamelProducerTemplateFactoryBean=java.lang.ref.WeakReference@f985d
, class java.util.ArrayList=java.lang.ref.WeakReference@1c23cec}]) but failed t
 remove it when the web application was stopped. Threads are going to be renewe
 over time to try and avoid a probable memory leak.
18-Nov-2013 17:36:57.883 SEVERE [localhost-startStop-1] org.apache.catalina.loa
er.WebappClassLoader.checkThreadLocalMapForLeaks The web application [/data-0.8
0] created a ThreadLocal with key of type [com.sun.xml.bind.v2.runtime.Coordina
or$1] (value [com.sun.xml.bind.v2.runtime.Coordinator$1@12db51d]) and a value o
 type [java.lang.Object[]] (value [[Ljava.lang.Object;@1cd848c]) but failed to
emove it when the web application was stopped. Threads are going to be renewed
ver time to try and avoid a probable memory leak.
18-Nov-2013 17:36:57.890 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployDirectory Deploying web application directory C:\Users\LAB-U
er2\Downloads\apache-tomcat-8.0.0-RC5\webapps\docs
18-Nov-2013 17:36:57.915 INFO [Finalizer] org.apache.catalina.loader.WebappClas
Loader.loadClass Illegal access: this web application instance has been stopped
already.  Could not load net.sourceforge.jtds.util.Logger.  The eventual follow
ng stack trace is caused by an error thrown for debugging purposes as well as t
 attempt to terminate the thread which caused the illegal access, and has no fu
ctional impact.
 java.lang.IllegalStateException
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLo
der.java:1461)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLo
der.java:1420)
        at net.sourceforge.jtds.jdbc.SharedSocket.close(SharedSocket.java:548)
        at net.sourceforge.jtds.jdbc.SharedSocket.finalize(SharedSocket.java:10
8)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

18-Nov-2013 17:36:57.986 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployDirectory Deploying web application directory C:\Users\LAB-U
er2\Downloads\apache-tomcat-8.0.0-RC5\webapps\examples
18-Nov-2013 17:36:58.276 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployDirectory Deploying web application directory C:\Users\LAB-U
er2\Downloads\apache-tomcat-8.0.0-RC5\webapps\host-manager
18-Nov-2013 17:36:58.357 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployDirectory Deploying web application directory C:\Users\LAB-U
er2\Downloads\apache-tomcat-8.0.0-RC5\webapps\manager
18-Nov-2013 17:36:58.433 INFO [localhost-startStop-1] org.apache.catalina.start
p.HostConfig.deployDirectory Deploying web application directory C:\Users\LAB-U
er2\Downloads\apache-tomcat-8.0.0-RC5\webapps\ROOT
18-Nov-2013 17:36:58.518 INFO [main] org.apache.coyote.AbstractProtocol.start S
arting ProtocolHandler ["http-apr-8081"]
18-Nov-2013 17:36:58.522 INFO [main] org.apache.coyote.AbstractProtocol.start S
arting ProtocolHandler ["ajp-apr-8009"]
18-Nov-2013 17:36:58.523 INFO [main] org.apache.catalina.startup.Catalina.start
Server startup in 45280 ms

kailash Joshi

unread,
Nov 18, 2013, 9:30:23 PM11/18/13
to groo...@googlegroups.com
I am not sure this will help you or not but we always have issue while deploying the build on tomcat,


 but it works 100% if we execute commands in order : grails clean && grails war && grails war

so creating the war twice always works for us and maximum time does not work if we build the war only once.. 

give it a try ..


--

Natalya Portnov

unread,
Nov 19, 2013, 1:02:41 PM11/19/13
to groo...@googlegroups.com
   Based my experience and the error posted there is something wrong with the database connection settings...
--
Natalya G. Portnov
IT Professional
University of Minnesota

Health Studies
200 Oak St SE, Suite 350
Minneapolis, MN 55455

T: 612.625.4329
F: 612.624.3370
E: n...@umn.edu
Reply all
Reply to author
Forward
0 new messages