Can you try the following patch?  And tell me if it helps?

john mcnally

Index:
src/java/org/apache/turbine/services/intake/TurbineIntakeService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntakeService.java,v
retrieving revision 1.17
diff -u -r1.17 TurbineIntakeService.java
---
src/java/org/apache/turbine/services/intake/TurbineIntakeService.java   
2001/07/14 19:36:30     1.17
+++
src/java/org/apache/turbine/services/intake/TurbineIntakeService.java   
2001/07/25 19:47:36
@@ -140,6 +140,15 @@
         throws InitializationException
     {
         String xmlPath = getConfiguration().getString(XML_PATH);
+
+        if ( xmlPath == null ) 
+        {
+            String pathError = 
+                "Path to intake.xml was not specified.  Check that the"
+
+                " property exists in TR.props and was loaded.";
+            getCategory().error(pathError);
+            throw new InitializationException(pathError);
+        }
         
         //!! need a constant
         String appDataPath = "WEB-INF/appData.ser";
@@ -163,11 +172,22 @@
                 XmlToAppData xmlApp = new XmlToAppData();
                 appData = xmlApp.parseFile(xmlPath);
 
-                OutputStream out = new FileOutputStream(serialAppData);
-                ObjectOutputStream p = new ObjectOutputStream(out);
-                p.writeObject(appData);
-                p.flush();
-                out.close();
+                try
+                {
+                    OutputStream out = new
FileOutputStream(serialAppData);
+                    ObjectOutputStream p = new ObjectOutputStream(out);
+                    p.writeObject(appData);
+                    p.flush();
+                    out.close();
+                }
+                catch (Exception e)
+                {
+                    getCategory().info(
+                        "Intake initialization could not be serialized
" +
+                        "because writing to " + appDataPath + " was not
" +
+                        "allowed.  This will require that the xml file
be " +
+                        "parsed when restarting the application.");
+                }
             }
 
             groupNames = new String[appData.getGroups().size()];



Scott Eade wrote:
> 
> Hi,
> 
> Today I have been trying to get my application working on an
> external server (i.e. one over which I have very little control).
> 
> The problems I have encountered so far all relate to Intake.
> While I am using the version of intake supplied with tdk 2.1,
> this version works fin on my development machine.
> 
> My first problem was that the <param-value> tag in my web.xml
> file included a "/" at the beginning of the path to TR.props.  This
> seemed to work fine here, but it seemed to cause problems on
> the server I am deploying to.  Basically adding some debug
> statements into TurbineIntakeService revealed that:
> 
>     String xmlPath = props.getProperty(XML_PATH);
> 
> was returning null.  This produces a not very helpful
> NullPointerException.  After removing the "/" it would seem
> that the server (Resin 1.2.5) was suddenly able to find TR.props
> and hence xmlPath was loaded with the correct value.  The
> odd thing about this is that on my development machine I have
> tomcat (that came with the tdk), and Resin 2.0.0 & Resin 1.2.8
> both of which seem to work correctly with "/" in web.xml.
> I can only assume that this is a weird configuration at my
> host provider.
> 
> Anyway, this has not solved my problem.  Now the problem is
> that when TurbineIntakeService attempts to write to appData.ser
> it gets a "Permission denied" error.
> 
> So my question now is, is there a way, say through web.xml that
> I can give turbine the necessary permissions to write to the appropriate
> directory or do I need to organize some special directory permissions?
> 
> >From turbine.log:
> 
> [Wed Jul 25 17:43:06 EST 2001] -- ERROR --
>  Exception:  org.apache.turbine.services.InitializationException: 
>TurbineIntakeService failed to initialize:
> /www/clientweb/au/b/backstagetech.com.au/./WEB-INF/appData.ser (Permission denied)
>  Stack Trace follows:
>  java.io.FileNotFoundException: 
>/www/clientweb/au/b/backstagetech.com.au/./WEB-INF/appData.ser (Permission denied)
>  at java.io.FileOutputStream.open(Native Method)
>  at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
>  at java.io.FileOutputStream.<init>(FileOutputStream.java:62)
>  at java.io.FileOutputStream.<init>(FileOutputStream.java:132)
>  at 
>org.apache.turbine.services.intake.TurbineIntakeService.init(TurbineIntakeService.java:183)
> rethrown as org.apache.turbine.services.InitializationException: 
>TurbineIntakeService failed to initialize:
> /www/clientweb/au/b/backstagetech.com.au/./WEB-INF/appData.ser (Permission denied)
>  at 
>org.apache.turbine.services.intake.TurbineIntakeService.init(TurbineIntakeService.java:227)
>  at org.apache.turbine.services.TurbineBaseService.init(TurbineBaseService.java:108)
>  at 
>org.apache.turbine.services.BaseInitableBroker.initClass(BaseInitableBroker.java:150)
>  at 
>org.apache.turbine.services.BaseServiceBroker.doInitService(BaseServiceBroker.java:226)
>  at 
>org.apache.turbine.services.BaseServiceBroker.initServices(BaseServiceBroker.java:195)
>  at org.apache.turbine.Turbine.init(Turbine.java:185)
>  at com.caucho.server.http.Application.createServlet(Application.java:1734)
>  at com.caucho.server.http.Application.loadServlet(Application.java:1698)
>  at com.caucho.server.http.Invocation.service(Invocation.java:255)
>  at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:121)
>  at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:333)
>  at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:266)
>  at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
>  at java.lang.Thread.run(Thread.java:484)
> 
> If anyone knows how to deal with this I would appreciate some help.
> 
> Thanks,
> 
> Scott
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to