... thanks for your suggestion, Kai, however

At 3:06 PM +0300 9/26/06, Kai S. Wong wrote:
In order to be deployment safe (original or servlet), you need to use *URL* method to access your resources. Replace your original method inputStreamForResourceNamed to pathURLForResourceNamed and open the URL stream via openStream().

... the Javadoc suggests pathURLForResourceNamed is deprecated:

         "Although WebObjects makes heavy use of this method internally, it is
          deprecated and inputStreamForResourceNamed or bytesForResourceNamed
          should be prefered when possible"

which is why I used inputStreamForResourceNamed. However, the documentation may be wrong - can a spell-checker would be in order (preferred) ...


... regardless of that, I changed my code to use pathURLForResourceNamed:

        fileName = "base-" + APP_PROP;
        try {
            inStream = app.resourceManager().
                          pathURLForResourceNamed(fileName, null, null).
                          openStream();
            p1 = new UMProperties (inStream);
        }
        catch (IOException x) {
            p1 = new UMProperties ();
        }

                  the result of this is to crash Tomcat!

INFO: Deploying web application archive MarketplaceApp.war
Sep 26, 2006 10:46:30 AM org.apache.catalina.session.StandardManager doLoad
SEVERE: IOException while loading persisted sessions: java.io.StreamCorruptedException
java.io.StreamCorruptedException
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1326)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)


If I comment out the code above the application executes as a servlet, then the app fails because it doesn't find the files it needs to read; when I restore the above code, Tomcat croaks.

Sadly, in the Apple documentation, there seems to be almost no documentation on how to write anything more than a trivial application. If/when I figure this out, I'll write a piece for the Wiki.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to