You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Suresh Thalamati <su...@gmail.com> on 2006/11/01 00:40:52 UTC

Re: Issue with Derby when using with IBM WebSphere Application Server Community Edition

Suraj Batuwana wrote:
> Hi Suresh,
> 

> 3.I do not see any files with zero length in the <database name> 
> seg0 directory of the database.

That's good news. zero-length files are the real scary ones.

> 
> 4) I am able to reproduce this error consistently on a new database also.
> 
> 5) I have attached my derby.log for your reference.
> 
> Looking at that I have found several interesting things.(I am assuming)
> While the nightly build tests are happing with derby/WASCE the derby shuting
> down and booting its instances. It seems that shuting down of instances are
> happening while the live connections are still there.
> 
> But when I running the same code base with derby/websphere 6.0.2.5 only one
> time boot up is happend. here It tries to shutdown and boot up the instance
> several times. Is there a way to stop or controll the  shuting down and boot
> up the derby instance.

Thanks for providing more info on this problem. By looking at the 
derby.log , the reason you are seeing many boot/shutdown sequences is 
when  derby fails to open the container file, it is serious error , so 
it shutdown the database automatically to avoid any chance for 
corruptions.  When a next attempt was made to connect to the database 
,it is attempting to boot again.


I looked at the stacks in the derby.log.  Real problem seems to be for 
some reason , derby engine is not unable to open the container files. 
It is happening while compiling a query and also during boot on 
recovery. That makes me inclined to believe it is an environment issue.

D:\wasce_build\TestBuild\build1\target\sampledb\seg0\c5d1.dat (Cannot 
create a file when that file already exists) at 
java.io.RandomAccessFile.open(Native Method) at 
java.io.RandomAccessFile.<INIT>(RandomAccessFile.java(Compiled Code))

 From the derby.log : unable to open these two files seg0\c5d1.dat and 
seg0\c2d0.dat.

Please check the permissions/owner ship of the file in the seg0. 
Typically the reason will be "Access denied ....". So I doubt
that is the case.

I wrote a small program to find what causes  "Cannot create a file 
when that file already exists" error case,  only time I am able to hit 
that is when system ran out of file handles(file descriptors).

After bit of googling found a reporred bug on jdk142 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4189011,  may be 
you are hitting this one.

When I tried my small program on jdk15, it managed to open 10000 
files, whereas on jdk142 (both on ibm and sun)  it was failing
around 2020 .

Derby does need so many file handles, it might be that something else 
is leaking the file descriptors  and derby is failing as side-effect. 
  It might be worth finding, all the open file handles on the system 
when this error occurs. I don't know how to do that on Windows.

One another thing,  I would try is  after you hit the error. Shutdown 
WAS and the network server and then  connect to the database using IJ 
and see if you can perform some queries on the database. If this works 
then is most likely a file descriptors problem.

Thanks
-suresh

Re: Issue with Derby when using with IBM WebSphere Application Server Community Edition

Posted by Suresh Thalamati <su...@gmail.com>.
Suraj Batuwana wrote:
> Hi Suresh,
> I have able to connect to the connect to the database using IJ 
> and performed some queries on the database. Is that means it has a file
> descriptors problem ? 

Thanks a lot for verifying. If you are able to boot , the it is not a 
corruption issue, for sure.  From the error,  as I mentioned earlier 
my suspicion is file descriptors are leaking some where in your 
application.

> how do we over come such an issue ?
If you can not find what part of the application is leaking the 
descriptors, I have no idea, how to solve it.
> 
> While I am testing for derby/WASCE i got another requirement, that is to
> deploy my application in 
> WAS6.0.2.5/derby10.2.1.6. But this time the requirement was to use the
> embedded driver. 
> 
> So I have used the org.apache.derby.jdbc.EmbeddedDriver as the jdbc driver
> and jdbc:derby:TestDB as 
> the database URL
> 
> This time I got a different error from the client side test classes
> Can't connect to url=jdbc:derby:TestDB
> java.sql.SQLException: Failed to start database 'TestDB', see the next

<snip ...>
> 	
> I have test this with ibm jdk 1.4.2. Is this happening due to the same kind
> of a issue as you described ?
> But this time i did not get any errors on derby.log
> 

If you are not seeing any errors in derby.log,  then may be it is a 
different problem. It might  be just a setup issue, I have no 
knowledge of setting up embedded database in the Webspehere 
environment, may be others on the list will be able to help you.


Thanks
-suresh



Re: Issue with Derby when using with IBM WebSphere Application Server Community Edition

Posted by Suraj Batuwana <sb...@virtusa.com>.
Hi Suresh,
I have able to connect to the connect to the database using IJ 
and performed some queries on the database. Is that means it has a file
descriptors problem ? 
how do we over come such an issue ?

While I am testing for derby/WASCE i got another requirement, that is to
deploy my application in 
WAS6.0.2.5/derby10.2.1.6. But this time the requirement was to use the
embedded driver. 

So I have used the org.apache.derby.jdbc.EmbeddedDriver as the jdbc driver
and jdbc:derby:TestDB as 
the database URL

This time I got a different error from the client side test classes
Can't connect to url=jdbc:derby:TestDB
java.sql.SQLException: Failed to start database 'TestDB', see the next
exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
	at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)

from the server side error was 
Caused by: java.sql.SQLException: Failed to start database
'E:\source\database\TestDB', see the next exception for details.DSRA0010E:
SQL State = XJ040, Error Code = 40,000DSRA0010E: SQL State = XJ040, Error
Code = 40,000
	at sun.reflect.GeneratedConstructorAccessor498.newInstance(Unknown Source)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled
Code))
	at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled
Code))
	at
com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(GenericDataStoreHelper.java:501)
	at
com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(GenericDataStoreHelper.java:544)
	at
com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:1037)

I have used the follings to create websphere derby datasource
	implementing class    
"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource"
	implementing class for XA     "org.apache.derby.jdbc.EmbeddedXADataSource"
	dataSource Helper Class Name    
"com.ibm.websphere.rsadapter.DerbyDataStoreHelper"
	
I have test this with ibm jdk 1.4.2. Is this happening due to the same kind
of a issue as you described ?
But this time i did not get any errors on derby.log

Thanks,
Suraj



Suresh Thalamati wrote:
> 
> Suraj Batuwana wrote:
>> Hi Suresh,
>> 
> 
>> 3.I do not see any files with zero length in the <database name> 
>> seg0 directory of the database.
> 
> That's good news. zero-length files are the real scary ones.
> 
>> 
>> 4) I am able to reproduce this error consistently on a new database also.
>> 
>> 5) I have attached my derby.log for your reference.
>> 
>> Looking at that I have found several interesting things.(I am assuming)
>> While the nightly build tests are happing with derby/WASCE the derby
>> shuting
>> down and booting its instances. It seems that shuting down of instances
>> are
>> happening while the live connections are still there.
>> 
>> But when I running the same code base with derby/websphere 6.0.2.5 only
>> one
>> time boot up is happend. here It tries to shutdown and boot up the
>> instance
>> several times. Is there a way to stop or controll the  shuting down and
>> boot
>> up the derby instance.
> 
> Thanks for providing more info on this problem. By looking at the 
> derby.log , the reason you are seeing many boot/shutdown sequences is 
> when  derby fails to open the container file, it is serious error , so 
> it shutdown the database automatically to avoid any chance for 
> corruptions.  When a next attempt was made to connect to the database 
> ,it is attempting to boot again.
> 
> 
> I looked at the stacks in the derby.log.  Real problem seems to be for 
> some reason , derby engine is not unable to open the container files. 
> It is happening while compiling a query and also during boot on 
> recovery. That makes me inclined to believe it is an environment issue.
> 
> D:\wasce_build\TestBuild\build1\target\sampledb\seg0\c5d1.dat (Cannot 
> create a file when that file already exists) at 
> java.io.RandomAccessFile.open(Native Method) at 
> java.io.RandomAccessFile.<INIT>(RandomAccessFile.java(Compiled Code))
> 
>  From the derby.log : unable to open these two files seg0\c5d1.dat and 
> seg0\c2d0.dat.
> 
> Please check the permissions/owner ship of the file in the seg0. 
> Typically the reason will be "Access denied ....". So I doubt
> that is the case.
> 
> I wrote a small program to find what causes  "Cannot create a file 
> when that file already exists" error case,  only time I am able to hit 
> that is when system ran out of file handles(file descriptors).
> 
> After bit of googling found a reporred bug on jdk142 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4189011,  may be 
> you are hitting this one.
> 
> When I tried my small program on jdk15, it managed to open 10000 
> files, whereas on jdk142 (both on ibm and sun)  it was failing
> around 2020 .
> 
> Derby does need so many file handles, it might be that something else 
> is leaking the file descriptors  and derby is failing as side-effect. 
>   It might be worth finding, all the open file handles on the system 
> when this error occurs. I don't know how to do that on Windows.
> 
> One another thing,  I would try is  after you hit the error. Shutdown 
> WAS and the network server and then  connect to the database using IJ 
> and see if you can perform some queries on the database. If this works 
> then is most likely a file descriptors problem.
> 
> Thanks
> -suresh
> 
> 

-- 
View this message in context: http://www.nabble.com/Issue-with-Derby-when-using-with-IBM-WebSphere-Application-Server-Community-Edition-tf2512964.html#a7154282
Sent from the Apache Derby Users mailing list archive at Nabble.com.