It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB in action Chapter 2 code error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB in action Chapter 2 code error" Watch "EJB in action Chapter 2 code error" New topic

EJB in action Chapter 2 code error

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1341


I am trying to run EJB3 in action Chapter 2 code.

I am using Jboss version 4.2.2GA.
I am using defulat DB (Hyersonic DB)

I ran ant script to build an EAR file for Chapter 2 code and then i placed the EAR file on Jboss'deploy folder. On placing EAR file, i get below mentioned error on command prompt

" java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@e69accf7[file =C:\jboss-4.2.2.GA\server\default\data\hypersonic\localDB.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: The process cannot access the file because another process has locked a portion of the file : C:\jboss-4.2.2.GA\server\default\data\"

I am not able to understand which process is having a lock on DB
Please help me


Oracle certified Java 8 Programmer I (1Z0-808), Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I, CIW Certified Ecommerce specialist
Davide Crudo
Ranch Hand

Joined: Sep 08, 2009
Posts: 62
...did you by any chance "kill" Jboss before?

It looks like you have a lock on the database that was not released...maybe jboss crashed or something and the lock remained...

Now i don't know hypersonic ...but sometimes on file based DBs you get the "lck" file with the current locked informations...and in
that case deleting the lck file would solve the issue...

...maybe try to copy the lck file out of the directory and see if it fixes the problem...


Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

In addition to what Dave mentioned, you actually can stop the server, delete the complete JBOSS_HOME/server/< servername>/data folder and start the server again.

[My Blog] [JavaRanch Journal]
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1341


I found the solution.

i was trying to create/build Chapter 2 code with JBOSS server running.
When i ran Chapter 2 Code ant script without JBOSS running, it worked for me

I agree. Here's the link:
subject: EJB in action Chapter 2 code error
It's not a secret anymore!