• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Regular v Servlet resource manager use
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular v Servlet resource manager use


  • Subject: Re: Regular v Servlet resource manager use
  • From: Gavin Eadie <email@hidden>
  • Date: Tue, 26 Sep 2006 11:00:58 -0400

... 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Regular v Servlet resource manager use (From: Gavin Eadie <email@hidden>)
 >Re: Regular v Servlet resource manager use (From: "Kai S. Wong" <email@hidden>)

  • Prev by Date: Re: WebObjects 5.3 and J2SE 5.0
  • Next by Date: Re: Regular v Servlet resource manager use
  • Previous by thread: Re: Regular v Servlet resource manager use
  • Next by thread: Re: Regular v Servlet resource manager use
  • Index(es):
    • Date
    • Thread