You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Feng Wang <fw...@gmail.com> on 2008/12/01 08:34:06 UTC

Re: Tuscany webapp problems with JBoss AS (access denied)

Some discussion on [1],perhaps it may help you.

[1] http://confluence.atlassian.com/pages/viewpage.action?pageId=104300830
	 
Thanks,
Feng Wang

On 2008-12-01 01:29:16,Jose Luis Alba <jo...@yahoo.es> wrote:

>Hi,
>
>Using JBoss 4.2.3GA and Tuscany SCA 1.3.2
>
>I'm having problems deploying the calculator-webapp sample into the 
>JBoss server. On Tomcat it works fine but the JBoss AS throws this 
>exception:
>
>java.security.PrivilegedActionException: java.io.FileNotFoundException: 
>D:\JBoss\4.2.3\server\default\.\deploy\sample-calculator-webapp.war 
>(Acceso denied)
>
>I've debugged the code and I've seen that the problem comes in 
>ContributionServiceImpl at lines 360-369. There's a privileged block 
>that throws the exception.
>
>I've tried to run JBoss with a security manager and with a security 
>policy with all permissions but neither it worked, the same exception 
>was thrown.
>
>Any ideas of how to solve the problem? Many thanks in advance,
>
>Jose Luis
>
>


Re: Tuscany webapp problems with JBoss AS (access denied)

Posted by Raymond Feng <en...@gmail.com>.
Hi,

Thank you for sharing the fix. Would you please open a JIRA at http://issues.apache.org/jira/browse/TUSCANY and contribute your patch there?

Raymond



From: Jose Luis Alba 
Sent: Monday, December 01, 2008 9:18 AM
To: user@tuscany.apache.org 
Subject: Re: Tuscany webapp problems with JBoss AS (access denied)


      Hi again,

      After a lot of debugging I've found what's happening with JBoss (any version surely) and Tuscany. Here it goes:

      1. We are at ContributionServiceImpl of the Tuscany 1.3.2 source, lines 357-369.
      2. URL points to the directory of the calculator war deployed in JBoss.

      - When running in JBoss the URL.getConnection() returns an instance of sun.net.www.protocol.file.FileURLConnection. The FileUrlConnection when invokes the getInputStream() tries to instance a FileInputStream. Here URL points to a directory (calculator-sample-webapp.war), then FileInputStream throws a FileNotFoundException (see FileInputStream signature in javadocs). On windows machines the error message is 'Access Denied' (?) and on Unix machines the error message is 'Is not a Directory' (more accurate).

      After reading all sources of PackageProcessor (the ones using the InputStream obtained from the URLConnection) I've seen that only JarContributionProcessor uses the InputStream object. FolderContributionProcessor, the one who reads directories, don't uses the InputStream object.

      Then, temporary, I've changed the code to:

              try {
                  if (!new File(sourceURL.toURI()).isDirectory()) {
                  // lines 357 to 369
                  }
              } catch (URISyntaxException ex) {
                  ex.printStackTrace();
              }
              
      And it worked fine.

      - When running in Tomcat it works fine because URL.getConnection() returns an instance sun.net.www.protocol.file.FileURLConnection and a java.io.ByteArrayInputStream when the getInputStream() method is called.

      - I think a JIRA is needed to better solve this situacion for JBoss servers.

      Bye and hope that helps others.

      Jose Luis

      --- El lun, 1/12/08, Feng Wang <fw...@gmail.com> escribió:

        De: Feng Wang <fw...@gmail.com>
        Asunto: Re: Tuscany webapp problems with JBoss AS (access denied)
        Para: "user@tuscany.apache.org" <us...@tuscany.apache.org>
        Fecha: lunes, 1 diciembre, 2008 8:34


Some discussion on [1],perhaps it may help you.[1] http://confluence.atlassian.com/pages/viewpage.action?pageId=104300830	 Thanks,Feng WangOn 2008-12-01 01:29:16,Jose Luis Alba <jo...@yahoo.es>
 wrote:>Hi,>>Using JBoss 4.2.3GA and Tuscany SCA 1.3.2>>I'm having problems deploying the calculator-webapp sample into the >JBoss server. On Tomcat it works fine but the JBoss AS throws this >exception:>>java.security.PrivilegedActionException: java.io.FileNotFoundException: >D:\JBoss\4.2.3\server\default\.\deploy\sample-calculator-webapp.war>(Acceso denied)>>I've debugged the code and I've seen that the problem comes in >ContributionServiceImpl at lines 360-369. There's a privileged block >that throws the exception.>>I've tried to run JBoss with a security manager and with a security >policy with all permissions but neither it worked, the same exception >was thrown.>>Any ideas of how to solve the problem? Many thanks in advance,>>Jose
 Luis>> 


Re: Tuscany webapp problems with JBoss AS (access denied)

Posted by Jose Luis Alba <jo...@yahoo.es>.
Hi again,

After a lot of debugging I've found what's happening with JBoss (any version surely) and Tuscany. Here it goes:

1. We are at ContributionServiceImpl of the Tuscany 1.3.2 source, lines 357-369.
2. URL points to the directory of the calculator war deployed in JBoss.

- When running in JBoss the URL.getConnection() returns an instance of sun.net.www.protocol.file.FileURLConnection. The FileUrlConnection when invokes the getInputStream() tries to instance a FileInputStream. Here URL points to a directory (calculator-sample-webapp.war), then FileInputStream throws a FileNotFoundException (see FileInputStream signature in javadocs). On windows machines the error message is 'Access Denied' (?) and on Unix machines the error message is 'Is not a Directory' (more accurate).

After reading all sources of PackageProcessor (the ones using the InputStream obtained from the URLConnection) I've seen that only JarContributionProcessor uses the InputStream object. FolderContributionProcessor, the one who reads directories, don't uses the InputStream object.

Then, temporary, I've changed the code to:

        try {
            if (!new File(sourceURL.toURI()).isDirectory()) {
            // lines 357 to 369
            }
        } catch (URISyntaxException ex) {
            ex.printStackTrace();
        }
        
And it worked fine.

- When running in Tomcat it works fine because URL.getConnection() returns an instance sun.net.www.protocol.file.FileURLConnection and a java.io.ByteArrayInputStream when the getInputStream() method is called.

- I think a JIRA is needed to better solve this situacion for JBoss servers.

Bye and hope that helps others.

Jose Luis

--- El lun, 1/12/08, Feng Wang <fw...@gmail.com> escribió:
De: Feng Wang <fw...@gmail.com>
Asunto: Re: Tuscany webapp problems with JBoss AS (access denied)
Para: "user@tuscany.apache.org" <us...@tuscany.apache.org>
Fecha: lunes, 1 diciembre, 2008 8:34

Some discussion on [1],perhaps it may help you.

[1] http://confluence.atlassian.com/pages/viewpage.action?pageId=104300830
	 
Thanks,
Feng Wang

On 2008-12-01 01:29:16,Jose Luis Alba <jo...@yahoo.es> wrote:

>Hi,
>
>Using JBoss 4.2.3GA and Tuscany SCA 1.3.2
>
>I'm having problems deploying the calculator-webapp sample into the 
>JBoss server. On Tomcat it works fine but the JBoss AS throws this 
>exception:
>
>java.security.PrivilegedActionException: java.io.FileNotFoundException: 
>D:\JBoss\4.2.3\server\default\.\deploy\sample-calculator-webapp.war

>(Acceso denied)
>
>I've debugged the code and I've seen that the problem comes in 
>ContributionServiceImpl at lines 360-369. There's a privileged block 
>that throws the exception.
>
>I've tried to run JBoss with a security manager and with a security 
>policy with all permissions but neither it worked, the same exception 
>was thrown.
>
>Any ideas of how to solve the problem? Many thanks in advance,
>
>Jose Luis
>
>