RE: [JBoss-dev] RE: InputStream and JarFile are not closed in getManifest()

2002-07-17 Thread Qingxian Wang




The 
problem seems more complicated than I thought initially. The suggested fix 
alone does not solve the problem. I also found input or output streams are 
not closed in more places spread in different packages. 


One of 
the causes of the problem, I think, is the wayhow the deployers 
work. When an application is deployed, JAR files are opened by creating 
new JarFile objects to peek the info of the JAR file. For example, in the 
accept() method of the JARDeployer class, JarFile object is created to check if 
the JAR file contains META-INF or *.xml file or not. But, the JarFile objects 
never closes because they are returned by JarURLConnection objects and it 
closing the JarFilecould cause the close of the application archive file 
and therefore will break the deployment. Hence, the files are left 
open. However, when the application is undeployed, there is no way to 
check if the file is open or not in the deployer system and the opened files 
never get closed. I think this is the reason why the temp files and directories 
cannot be deleted during undeploying an application. And, it is also the 
reason why repeated deploy and undeploy eventually causes "Too many open files" 
problem.

Some 
non-trivial work might need to sort this out.

Please 
let me know if I am correct or not.

Regards

Qingxian


  -Original 

  -Original Message-From: Scott M Stark 
  [mailto:[EMAIL PROTECTED]]Sent: 16 July 2002 
  18:29To: [EMAIL PROTECTED]Subject: 
  Re: [JBoss-dev] RE: InputStream and JarFile are not closed in 
  getManifest()
  Have you verified that the suggested change fixes 
  the problem?
  
  Scott StarkChief Technology 
  OfficerJBoss Group, LLC
  
- Original Message - 
From: 
    Qingxian Wang 
To: '[EMAIL PROTECTED]' 

Sent: Tuesday, July 16, 2002 10:00 
AM
Subject: [JBoss-dev] RE: InputStream 
and JarFile are not closed in getManifest()

And this the reason why JBoss cannot delete the files after undeploy 
EAR files or SAR files.

Qingxian

  -Original Message-From: Qingxian Wang 
  Sent: 16 July 2002 17:55To: '[EMAIL PROTECTED]'Subject: 
  InputStream and JarFile are not closed in 
  getManifest()
  The getManifest() method of DeploymentInfo class 
  in org.jboss.deployment package does not close FileInputStream and JarFile 
  after creating or getting a Manifest object. This perhaps is the 
  reason why JBoss cannot close JAR files when undeploying EAR or SAR files 
  and therefore "Too many open files" problem is caused. 
  
  
  The snipet of the JBoss (3.0.0) code is as 
  follows:
  
  /** * getManifest returns 
  (if present) the deployment's manifest * it is lazy 
  loaded to work from the localURL */ 
  public Manifest getManifest()  
  { try  
  { if (manifest == 
  null) 
  { 
  File file = new 
  File(localUrl.getFile()); 
   if 
  (file.isDirectory()) 
   
  manifest= new Manifest(new FileInputStream(new File(file, 
  "META-INF/MANIFEST.MF"))); 
   
  else // a 
  jar 
  manifest = new 
  JarFile(file).getManifest(); 
   
  } 
   return 
  manifest; 
  } // It is ok to barf at any time in the 
  above, means no manifest catch 
  (Exception ignored) { return null;} }
  
  
  The suggested changesare as 
  below:
  
  public Manifest getManifest()  
  { try  
  { if (manifest == 
  null) 
  { 
  File file = new 
  File(localUrl.getFile()); 
   if 
  (file.isDirectory()) 
  { 
  FileInputStream fis = null; 
   
  try 
  { 
  fis = new FileInputStream(new File(file, 
  "META-INF/MANIFEST.MF")); 
  manifest= new 
  Manifest(fis); 
  } finally {// close the input 
  stream 
  fis.close(); 
  } } 
  else {// a 
  jar 
  JarFile jarFile = new 
  JarFile(file); 
  try 
  { 
  manifest = 
  jarFile.getManifest(); 
  } finally { // close the 
  JarFile 
  jarFile.close(); 
  } 
  } 
   
  } 
   return 
  manifest; 
  } // It is ok to barf at any time in the 
  above, means no manifest catch 
  (Exception ignored) { return null;} }
  
      
  Regards
  
  Qingxian 
Wang



This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Please notify the sender by e-mail or telephone.

We utilise an anti-virus system and therefore any files sent via e-mail will have been checked for known viruses. You are however advised to run your own virus check before opening any at

[JBoss-dev] Too many open files problem

2002-07-16 Thread Qingxian Wang



Hi,

We 
used Windows Performance Monitor (perfmon command) to monitor the handle counter 
of the Java process of JBoss. It shows that we deploying and undeploying 
an EAR file, JBoss does not release all file handles that should be 
released. When we are repeating deploy-undeploy process on the same EAR 
file, the handle counter increased steadily until no more file handles left for 
JBoss to use. At that time, JBoss throws 
java.io.FileNotFoundException. 

I 
guess that JBoss does not clean out the reference to certian JAR files held 
after undeployed an EAR file. 

This 
problem can cause a system to fail periodically.

Regards

Qingxian



This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Please notify the sender by e-mail or telephone.

We utilise an anti-virus system and therefore any files sent via e-mail will have been checked for known viruses. You are however advised to run your own virus check before opening any attachments received as we will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. Any views expressed by an individual within this e-mail do not necessarily reflect the views of Systems Union Group plc or any of its subsidiary companies.



[JBoss-dev] InputStream and JarFile are not closed in getManifest()

2002-07-16 Thread Qingxian Wang



The 
getManifest() method of DeploymentInfo class in org.jboss.deployment package 
does not close FileInputStream and JarFile after creating or getting a Manifest 
object. This perhaps is the reason why JBoss cannot close JAR files when 
undeploying EAR or SAR files and therefore "Too many open files" problem is 
caused. 

The 
snipet of the JBoss (3.0.0) code is as follows:

/** * getManifest returns (if 
present) the deployment's manifest * it is lazy loaded to 
work from the localURL */ public Manifest 
getManifest()  { try 
 
{ if (manifest == 
null) 
{ File 
file = new 
File(localUrl.getFile()); 
 if 
(file.isDirectory()) 
 
manifest= new Manifest(new FileInputStream(new File(file, 
"META-INF/MANIFEST.MF"))); 
 else // a 
jar 
manifest = new 
JarFile(file).getManifest(); 
 
} 
 return 
manifest; } 
// It is ok to barf at any time in the above, means no 
manifest catch (Exception ignored) { return 
null;} }


The 
suggested changesare as below:

public 
Manifest getManifest()  { try 
 
{ if (manifest == 
null) 
{ File 
file = new 
File(localUrl.getFile()); 
 if 
(file.isDirectory()) 
{ 
FileInputStream fis = null; 
 
try 
{ 
fis = new FileInputStream(new File(file, 
"META-INF/MANIFEST.MF")); 
manifest= new 
Manifest(fis); 
} finally {// close the input 
stream 
fis.close(); 
} } else 
{// a 
jar 
JarFile jarFile = new 
JarFile(file); 
try 
{ 
manifest = 
jarFile.getManifest(); 
} finally { // close the 
JarFile 
jarFile.close(); 
} 
} 
 
} 
 return 
manifest; } 
// It is ok to barf at any time in the above, means no 
manifest catch (Exception ignored) { return 
null;} }


Regards

Qingxian Wang



This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Please notify the sender by e-mail or telephone.

We utilise an anti-virus system and therefore any files sent via e-mail will have been checked for known viruses. You are however advised to run your own virus check before opening any attachments received as we will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. Any views expressed by an individual within this e-mail do not necessarily reflect the views of Systems Union Group plc or any of its subsidiary companies.



[JBoss-dev] RE: InputStream and JarFile are not closed in getManifest()

2002-07-16 Thread Qingxian Wang



And 
this the reason why JBoss cannot delete the files after undeploy EAR files or 
SAR files.

Qingxian

  -Original Message-From: Qingxian Wang 
  Sent: 16 July 2002 17:55To: 
  '[EMAIL PROTECTED]'Subject: InputStream and 
  JarFile are not closed in getManifest()
  The 
  getManifest() method of DeploymentInfo class in org.jboss.deployment package 
  does not close FileInputStream and JarFile after creating or getting a 
  Manifest object. This perhaps is the reason why JBoss cannot close JAR 
  files when undeploying EAR or SAR files and therefore "Too many open files" 
  problem is caused. 
  
  The 
  snipet of the JBoss (3.0.0) code is as follows:
  
  /** * getManifest returns (if 
  present) the deployment's manifest * it is lazy loaded 
  to work from the localURL */ public 
  Manifest getManifest()  { 
  try  
  { if (manifest == 
  null) 
  { File 
  file = new 
  File(localUrl.getFile()); 
   if 
  (file.isDirectory()) 
   
  manifest= new Manifest(new FileInputStream(new File(file, 
  "META-INF/MANIFEST.MF"))); 
   else // 
  a 
  jar 
  manifest = new 
  JarFile(file).getManifest(); 
   
  } 
   return 
  manifest; 
  } // It is ok to barf at any time in the 
  above, means no manifest catch (Exception 
  ignored) { return null;} }
  
  
  The 
  suggested changesare as below:
  
  public Manifest getManifest()  
  { try  
  { if (manifest == 
  null) 
  { File 
  file = new 
  File(localUrl.getFile()); 
   if 
  (file.isDirectory()) 
  { 
  FileInputStream fis = null; 
   
  try 
  { 
  fis = new FileInputStream(new File(file, 
  "META-INF/MANIFEST.MF")); 
  manifest= new 
  Manifest(fis); 
  } finally {// close the input 
  stream 
  fis.close(); 
  } } else 
  {// a 
  jar 
  JarFile jarFile = new 
  JarFile(file); 
  try 
  { 
  manifest = 
  jarFile.getManifest(); 
  } finally { // close the 
  JarFile 
  jarFile.close(); 
  } 
  } 
   
  } 
   return 
  manifest; 
  } // It is ok to barf at any time in the 
  above, means no manifest catch (Exception 
  ignored) { return null;} }
  
  
  Regards
  
  Qingxian Wang



This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Please notify the sender by e-mail or telephone.

We utilise an anti-virus system and therefore any files sent via e-mail will have been checked for known viruses. You are however advised to run your own virus check before opening any attachments received as we will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. Any views expressed by an individual within this e-mail do not necessarily reflect the views of Systems Union Group plc or any of its subsidiary companies.



RE: [JBoss-dev] EAR deployment/undeployment problem

2002-07-12 Thread Qingxian Wang

Hi Alexandre,

It seems to me that when delete the EAR file from the deploy directory of
JBoss, the JBoss server did not undeploy completely the application that you
deployed reviously, i.e. it did not clean off the old classloader or class
objects in the classloader repository.  I had the similar problem when I was
doing hot deploy.  What I did to get rid of the problem is to do the
undeploy by calling the MainDeployer of the JBoss first, and then redeploy
the EAR by calling the MainDeployer of the JBoss.  By this way, you do not
need to copy your EAR file to the deploy directory to JBoss, but you need to
write you ANT task Java class to do it.

Actually, you do not need to delete the tmp directory if you restart JBoss
because restarting JBoss clean off the classloader repository from the
memory.

Hope this helps a little.

Qingxian


-Original Message-
From: Alexandre Aubry [mailto:[EMAIL PROTECTED]]
Sent: 12 July 2002 17:24
To: [EMAIL PROTECTED]
Subject: [JBoss-dev] EAR deployment/undeployment problem


Hi,

We have an application in development. This
application
is composed of servlet, jsp, ejb (SBSL  Entity CMP)
and
basic beans.
To test our development, we are packaging this
application
within on EAR file and then deploy it to JBoss 3.0.

The problem is when we undeploy the EAR (delete the
file from the deploy directory of JBoss) or redeploy
the
EAR file (copy a new modified EAR file in the deploy
dir.
of JBoss), the client (standalone programm which call
the SBSL Facade's methods) has an exception : 

RemoteException occurred in server thread; nested
exception is: 
java.rmi.ServerException: null
Embedded Exception
$Proxy122; nested exception is: 
javax.ejb.EJBException: null
Embedded Exception
$Proxy122


If we shutdown JBoss, delete all files within
server/default/tmp directory (contains temporary files
of deployed applications), and the restard JBoss with
the *same* EAR file and start the client, guess what? 
it works...

Of course, this behavior is very, very unconfortable
and 
we waste precious time to undeploy, stop, delete temp 
files, start, deploy and finally test.

Do you have the same issue? Do you have any idea?
Jboss says that you can deploy/undeploy application...

We try JBoss 3.0.1 and it still not work :-(

Thanks for your different answers.

Alexandre Aubry
France - Sophia Antipolis


___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Gadgets, caffeine, t-shirts, fun stuff.
http://thinkgeek.com/sf
___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development


This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom it is addressed. If
you have received this e-mail in error you must not copy, distribute or take
any action in reliance on it. Please notify the sender by e-mail or
telephone.
We utilise an anti-virus system and therefore any files sent via e-mail will
have been checked for known viruses. You are however advised to run your own
virus check before opening any attachments received as we will not in any
event accept any liability whatsoever once an e-mail and/or any attachment
is received. Any views expressed by an individual within this e-mail do not
necessarily reflect the views of Systems Union Group plc or any of its
subsidiary companies.



---
This sf.net email is sponsored by:ThinkGeek
Gadgets, caffeine, t-shirts, fun stuff.
http://thinkgeek.com/sf
___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development