Websphere 6.1 ear asset problem
-------------------------------

                 Key: TAPESTRY-2273
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2273
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.1.5, 4.1.3, 4.1.2
         Environment: WinXP SP2, Java 1.5.14, Tapestry 4.1.2 (also  4.1.5), IBM 
Websphere 6.1
            Reporter: Christian Nutz
            Priority: Critical
             Fix For: 4.1.6


We are using Tapestry 4.0 for our project and all works fine.
Now we want migrate to Tapestry 4.1.5 but in our Websphere environment 
css-assets are not loaded (The css is embedded via Asset in the html header of 
our page).
In the source of the generated html page the css is not correct resolved and 
looks like this:

<head>
  <title>XYZ</title>    
  <link 
href="/xyz/app?digest=xxxxx&amp;service=asset&amp;path=%2Fpage_x%2Fpage_x.css" 
type="text/css" rel="stylesheet" id="Any_0"></link>
</head>

The correspondending java class creates the css link via 
"AbstractComponent.getAsset("pageCss").buildURL()".


The Websphere log says:

SRTServletRes W   WARNING: Cannot set header. Response already committed.



After debugging, we found the reason for this issue.

If you deploy an war file in Websphere application server, Websphere creates an 
ear file with the war included. The classpath is:

C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ws-product03Node01Cell\demoApp.ear\demoApp.war\WEB-INF\classes;
C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ws-product03Node01Cell\demoApp.ear\demoApp.war\WEB-INF\lib\tapestry-annotations-4.1.5.jar;
C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ws-product03Node01Cell\demoApp.ear\demoApp.war\WEB-INF\lib\tapestry-contrib-4.1.5.jar;
C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ws-product03Node01Cell\demoApp.ear\demoApp.war\WEB-INF\lib\tapestry-framework-4.1.5.jar;
C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ws-product03Node01Cell\demoApp.ear\demoApp.war

And our directory structure looks like this:

demoApp
demoApp/styles
demoApp/html
demoApp/WEB-INF


Tapestry tries to load an Asset with an AssetFactory.
In the class org.apache.tapestry.assetAssetSourceImpl the method 
findAssetFactory(IComponentSpecification spec, Resource baseResource, String 
path, Locale locale) is used for this.

It looks up the factory in this way:

AssetFactory findAssetFactory(IComponentSpecification spec, Resource 
baseResource, String path, Locale locale) {
   // need to check these two core factories in order first

   if (_classpathAssetFactory.assetExists(spec, baseResource, path, locale))
       return _classpathAssetFactory;

   if (_contextAssetFactory.assetExists(spec, baseResource, path, locale))
       return _contextAssetFactory;
            
   ....
        
}

As you can see for the ear file, the styles directory is visble from classpath 
and _classpathAssetFactory.assetExists() will return true.
And this is the problem.
Like in Tapestry 4.0, you have to check first 
_contextAssetFactory.assetExists() and then 
_classpathAssetFactory.assetExists().

After applying the patch (changing the order to return the assetFactory), the 
problem was solved for us.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to