Redeploying a war file in tomcat 6.0.16

156 views
Skip to first unread message

Ro

unread,
Nov 13, 2008, 8:32:10 AM11/13/08
to H2 Database
Hi all,
I am trying to redeploy war file with out restarting the tomcat.
When I copied the changed war file into tomcat, my application got
undeployed and tomcat is trying to deploy the application as per
changed war file. But not able to redeploy the war file.

I am getting the following error

Nov 13, 2008 6:46:48 PM org.apache.catalina.startup.HostConfig
checkResources
INFO: Undeploying context [/evpn]
Nov 13, 2008 6:46:49 PM org.apache.catalina.startup.HostConfig
deployWAR
INFO: Deploying web application archive evpn.war
Nov 13, 2008 6:48:17 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Nov 13, 2008 6:48:17 PM org.apache.catalina.loader.WebappClassLoader
loadClass
INFO: Illegal access: this web application instance has been stopped
already. Could not load org.h2.util.CacheObject$1. The eventual
following stack trace is caused by an error thrown for debugging
purposes as well as to attempt to terminate the thread which caused
the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass
(WebappClassLoader.java:1246)
at org.apache.catalina.loader.WebappClassLoader.loadClass
(WebappClassLoader.java:1206)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.h2.util.CacheObject.sort(CacheObject.java:65)
at org.h2.store.DiskFile.flush(DiskFile.java:436)
at org.h2.index.BtreeIndex.flush(BtreeIndex.java:190)
at org.h2.index.BtreeIndex.close(BtreeIndex.java:205)
at org.h2.table.TableData.close(TableData.java:83)
at org.h2.engine.Database.close(Database.java:1024)
at org.h2.engine.Database.removeSession(Database.java:963)
at org.h2.engine.Session.close(Session.java:431)
at org.h2.engine.Database.close(Database.java:996)
at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:73)
Nov 13, 2008 6:48:18 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Nov 13, 2008 6:48:18 PM org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].
[localhost].[/examples] has not been started
Nov 13, 2008 6:48:18 PM org.apache.coyote.http11.Http11Protocol
destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080


In our application we are connecting to H2 database. One servlet
Context Listener starts with tomcat which takes care of connecting to
database and creating tables . When the servlet Context is going to
destroy(stopping tomcat) H2 data base will get closed. So when i am
trying to redeploy the application war file I am getting the above
error.

Thanx for your help.....

Thomas Mueller

unread,
Nov 14, 2008, 11:51:38 AM11/14/08
to h2-da...@googlegroups.com
Hi,

> I am trying to redeploy war file with out restarting the tomcat.
> When I copied the changed war file into tomcat, my application got
> undeployed and tomcat is trying to deploy the application as per
> changed war file. But not able to redeploy the war file.

> In our application we are connecting to H2 database. One servlet


> Context Listener starts with tomcat which takes care of connecting to
> database and creating tables . When the servlet Context is going to
> destroy(stopping tomcat) H2 data base will get closed.

It looks like you didn't close all database connection. Could you
verify all connections are closed?

> So when i am
> trying to redeploy the application war file I am getting the above
> error.

This exception shouldn't be a problem. Is there another exception in
the log file? For example that the database is already in use by
another process?

Regards,
Thomas

Thomas Mueller

unread,
Nov 14, 2008, 11:53:22 AM11/14/08
to h2-da...@googlegroups.com
Hi again,

> This exception shouldn't be a problem.

What I mean is: it shouldn't prohibit to start the web application
again. But it's not a nice exception, and I will try to find a
solution so the exception doesn't appear. In the next release, the
database will try to detect if the classloader or virtual machine has
almost shut down by checking if static final variables are set to
null. This should help reduce exceptions when stopping the web
application.

Regards,
Thomas

Ro

unread,
Nov 17, 2008, 5:00:11 AM11/17/08
to H2 Database
Hi Thomas,
The below problem got solved by closing the connctions properly.

INFO: Illegal access: this web application instance has been stopped
already. Could not load org.h2.util.CacheObject$1. The eventual
following stack trace is caused by an error thrown for debugging
purposes as well as to attempt to terminate the thread which caused
the illegal access, and has no functional impact.
java.lang.IllegalStateException

But my tomcat is undeployed the application and trying to deploy the
new war file.
But tomcat did not able to redeploy the war file and no errors in to
log file also.
I am using tomcat 6.0.16. Msg in the log file is as follows
INFO: Undeploying context [/evpn]
Nov 17, 2008 3:21:21 PM org.apache.catalina.startup.HostConfig
deployWAR
INFO: Deploying web application archive evpn.war
Nov 17, 2008 3:22:59 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Nov 17, 2008 3:23:00 PM org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].
[localhost].[/examples] has not been started
Nov 17, 2008 3:23:00 PM org.apache.coyote.http11.Http11Protocol
destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

Sorry for posting exactly tomcat question in h2 forum. If possible
your help values more to me.
Thanq very much..............
On Nov 14, 9:53 pm, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:

Thomas Mueller

unread,
Nov 18, 2008, 3:53:12 PM11/18/08
to h2-da...@googlegroups.com
Hi,

> The below problem got solved by closing the connctions properly.

> But my tomcat is undeployed the application and trying to deploy the


> new war file.
> But tomcat did not able to redeploy the war file and no errors in to
> log file also.

That's strange. Could you check the database log file as well
(.trace.db files)? If you don't find the reason in a log file then I
don't know exactly how this could be solved... You could try to debug
Tomcat but I guess that's complicated. Maybe a thread is stuck? You
could create a few 'full thread dumps' (Ctrl+Pause in Windows; if you
have Java 1.6 you could you jps -l, and then jstack <pid>). Sometimes
threads are stuck in strange places (I remember the random generator
was sometimes stuck when initializing).

Regards,
Thomas

Ro

unread,
Dec 8, 2008, 8:28:52 AM12/8/08
to H2 Database
Hi Thomas,
In my application i am trying to connect to H2 database by using
following code.
if (!(webSrv != null && webSrv.isRunning(false))) {
webSrv = Server.createWebServer(new String[] { "-
webAllowOthers" }).start();

}


if (!(ftpSrv != null && ftpSrv.isRunning(false))) {
ftpSrv = Server.createFtpServer(new String[] { "-
webAllowOthers" }).start();

}


if (!(tcpSrv != null && tcpSrv.isRunning(false))) {
tcpSrv = Server.createTcpServer(new String[] { "-trace" }).start
();


}


conn = DriverManager.getConnection("jdbc:h2:evpn","evpn", "evpn");
Using the above code i am able to connect to database through
Hybernate. And i can open the H2 console also by using http://localhost:8082/

Now the problem is:-
I am redeploying the application in tomcat with out restarting the
tomcat. When i am redeploying the application in to tomcat with out
opening the H2 console It is able to redeploy with out any error.
But if i open the H2 console and then trying to redeploy the
application war file in to tomcat then it is saying to open in the
server mode.
Error is:-
org.h2.jdbc.JdbcSQLException: Database may be already in use: Locked
by another process. Possible solutions: close all other connection
(s);
use the server mode
[90020-76]


Now i am not able to open the H2 console & also i am not able to run
my application in tomcat.






On Nov 19, 1:53 am, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:

Thomas Mueller

unread,
Dec 14, 2008, 4:19:26 AM12/14/08
to h2-da...@googlegroups.com
Hi,

Sorry I repeat my previous answer:

You need to stop the H2 servers when the web application is stopped.
You can use a ServletContextListener, as it is done in
org.h2.server.web.DbStarter (the source code is included in H2).
Basically, start the servers when the listener is started
(contextInitialized), and stop then when it it stopped
(contextDestroyed). See also
http://code.google.com/p/h2database/source/browse/trunk/h2/src/main/org/h2/server/web/DbStarter.java

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages