Re: javax.servlet.UnavailableException: Error initializing servlet adaptor: null
Re: javax.servlet.UnavailableException: Error initializing servlet adaptor: null
- Subject: Re: javax.servlet.UnavailableException: Error initializing servlet adaptor: null
- From: Theodore Petrosky <email@hidden>
- Date: Fri, 31 May 2013 11:57:38 -0700 (PDT)
according to the developer,
http://web-cat.org/node/2/content/forum
http://people.cs.vt.edu/~edwards/
http://web-cat.org/content/initial-setup-load-issues
i like the last link.
Ted
--- On Fri, 5/31/13, Filippo Laurìa <email@hidden> wrote:
> From: Filippo Laurìa <email@hidden>
> Subject: javax.servlet.UnavailableException: Error initializing servlet adaptor: null
> To: "WebObjects-dev apple dot com" <email@hidden>
> Date: Friday, May 31, 2013, 1:35 PM
> Hello everyone,
>
> --
> Always on the same WebObjects application (Web-CAT) that, as
> I already
> said few mails ago, it's a collection of WebObjects
> frameworks linked
> together.
> --
>
> Now that I solved the problem described here [1], I
> encountered some
> troubles that I think are more serious than previous.
>
> Web-CAT uses a custom ServletAdaptor WCServletAdaptor that
> extends
> WOServletAdaptor adding some capabilities (as update
> checking, etc.).
>
> I would underline that this class overrides init() method
> that is
> throwing the exception mentioned into this thread' subject.
>
> I modified init() method to prevent download of updates from
> Web-CAT
> update center.
>
> "original" init() method was:
> --
> public void init() throws ServletException {
> String webInfRoot =
> super.getServletContext().getRealPath("WEB-INF");
> File webInfDir = new
> File(webInfRoot);
> propertiesFile = new
> File(webInfDir, "update.properties");
> updateDir = new File(webInfDir,
> UPDATE_SUBDIR);
> loadProperties();
>
> applyNecessaryUpdates(webInfDir);
> try {
> super.init();
> } catch (NoClassDefFoundError e)
> {
> initFailed = e;
> } catch
> (javax.servlet.UnavailableException e) {
> initFailed = e;
> }
> }
> --
>
> I did a simple modification:
> public void init() throws ServletException {
> String webInfRoot =
> super.getServletContext().getRealPath("WEB-INF");
> File webInfDir = new
> File(webInfRoot);
> propertiesFile = new
> File(webInfDir, "update.properties");
> updateDir = new File(webInfDir,
> UPDATE_SUBDIR);
> loadProperties();
>
> compute_woClasspatch(webInfDir);
>
> //applyNecessaryUpdates(webInfDir);
> try {
> super.init();
> } catch (NoClassDefFoundError e)
> {
> initFailed = e;
> } catch
> (javax.servlet.UnavailableException e) {
> initFailed = e;
> }
> }
>
> here they are functions used:
>
> --
> private void loadProperties() {
> properties = new Properties();
> if (propertiesFile.exists()) {
> try {
>
> InputStream is = new FileInputStream(propertiesFile);
>
> properties.load(is);
>
> is.close();
> } catch
> (IOException e) {
>
> System.out.println("Error loading properties from "
>
> +
> propertiesFile.getAbsolutePath() + ":" + e);
> }
> }
> }
>
> private void compute_woClasspatch(File
> webInfDir) {
> File mainBundle = null;
> if (webInfDir.isDirectory()) {
> File[]
> bundleSearchDirs = webInfDir.listFiles();
>
> //ottiene il path
> assoluto della root dei frameworks
> for (int i = 0; i
> < bundleSearchDirs.length; i++) {
> if
> (bundleSearchDirs[i].isDirectory()
>
> && bundleSearchDirs[i].getName().endsWith(".woa"))
> {
>
> mainBundle = new File(bundleSearchDirs[i],
> "Contents");
>
>
> String absolutePath =
> bundleSearchDirs[i].getAbsolutePath();
>
>
> frameworkDir = new File(absolutePath +
> FRAMEWORK_SUBDIR1);
>
>
> if (!frameworkDir.exists())
>
> frameworkDir = new
> File(absolutePath +
> FRAMEWORK_SUBDIR2);
>
> break;
> }
> }
> }
>
> if (frameworkDir != null
> && frameworkDir.isDirectory()) {
> File[] subdirs =
> frameworkDir.listFiles();
>
> java.util.Arrays.sort(subdirs, new FrameworkComparator());
> woClasspath =
> classPathFrom(subdirs, mainBundle);
>
> System.out.println("Dynamically computed classpath:");
>
> System.out.print(woClasspath);
> }
> }
>
> private void applyNecessaryUpdates(File webInfDir) {
> File mainBundle = null;
> if (webInfDir.isDirectory()) {
> File[]
> bundleSearchDirs = webInfDir.listFiles();
> for (int i = 0; i
> < bundleSearchDirs.length; i++) {
> if
> (bundleSearchDirs[i].isDirectory()
>
> &&
> bundleSearchDirs[i].getName().endsWith(".woa")) {
>
> mainBundle = new File(bundleSearchDirs[i],
> "Contents");
>
> frameworkDir = new File(
>
>
> bundleSearchDirs[i].getAbsolutePath()
>
>
> + FRAMEWORK_SUBDIR1);
>
> if (!frameworkDir.exists()) {
>
> frameworkDir = new File(
>
>
> bundleSearchDirs[i].getAbsolutePath()
>
>
> + FRAMEWORK_SUBDIR2);
>
> }
>
> break;
> }
> }
> File appDir =
> webInfDir.getParentFile();
>
> downloadNewUpdates(frameworkDir, mainBundle);
>
> applyPendingUpdates(frameworkDir, appDir);
>
> refreshSubsystemUpdaters(frameworkDir, mainBundle);
> }
> if (frameworkDir != null
> && frameworkDir.isDirectory()) {
> File[] subdirs =
> frameworkDir.listFiles();
>
> java.util.Arrays.sort(subdirs, new FrameworkComparator());
> woClasspath =
> classPathFrom(subdirs, mainBundle);
>
> System.out.println("Dynamically computed classpath:");
>
> System.out.print(woClasspath);
> }
> }
>
>
> So you noticed that exception is thrown while recalling
> _super.init();_
> How can it be possible? I mean, the only things done, before
> calling
> it, are some string manipulations and other operations on
> files.
>
> Why a javax.servlet.UnvailableException is thrown?
>
> Having a look on the internet, some say that, perhaps, this
> exception
> comes out when there's some database connection's troubles.
> Is it
> possible in this case?
>
> Anyway, what can I do to fix this problem?
>
>
> I'm sorry, if I wrote a lot of stuff but I would like to
> explain very
> well this problem.
>
>
> Thank you everyone.
>
> [1]: http://lists.apple.com/archives/webobjects-dev/2013/May/msg00256.html
> _______________________________________________
> 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
>
_______________________________________________
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