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: Chuck Hill <email@hidden>
- Date: Tue, 04 Jun 2013 08:41:43 -0700
Yes, it looks like the jar in JavaWebObjects framework is not on the classpath.
Chuck
On 2013-06-04, at 12:17 AM, Filippo Laurìa wrote:
> Thanks for your answer.
> I alredy knew this last link, but it is "high-level support".. After
> few trials, I think I have a classpath problem but I can't understand
> very well where the problem is.
>
> If someone is instrested here it is complete exception stack trace:
>
> -- --
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at com.webobjects.jspservlet.WOServletAdaptor._applicationInit(WOServletAdaptor.java:421)
> at com.webobjects.jspservlet.WOServletAdaptor.initStatics(WOServletAdaptor.java:95)
> at com.webobjects.jspservlet.WOServletAdaptor.init(WOServletAdaptor.java:652)
> at net.sf.webcat.WCServletAdaptor.init(WCServletAdaptor.java:122)
> at javax.servlet.GenericServlet.init(GenericServlet.java:160)
> at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189)
> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
> at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
> at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4935)
> at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5262)
> at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5257)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: com.webobjects.foundation.NSForwardException
> [java.lang.ClassNotFoundException]
> com.webobjects.appserver.WOSessionStore:<net.sf.webcat.core.Application>
> failed instantiation. Exception thrown :
> java.lang.NoClassDefFoundError:
> com/webobjects/appserver/WOSessionStore:
> com/webobjects/appserver/WOSessionStore
> at com.webobjects.foundation._NSUtilities._explainInstantiationException(_NSUtilities.java:632)
> at com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:646)
> at com.webobjects.appserver.WOApplication.primeApplication(WOApplication.java:634)
> ... 20 more
> Caused by: java.lang.ClassNotFoundException:
> com.webobjects.appserver.WOSessionStore
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
> at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)
> at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:410)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:188)
> at com.webobjects.foundation._NSUtilities._classWithPartialName(_NSUtilities.java:348)
> at com.webobjects.foundation._NSUtilities.classWithName(_NSUtilities.java:335)
> at com.webobjects.appserver.WOApplication._instanceOfNamedClassAssignableFrom(WOApplication.java:5831)
> at com.webobjects.appserver.WOApplication.setSessionStoreClassName(WOApplication.java:5021)
> at com.webobjects.appserver.WOApplication.<init>(WOApplication.java:857)
> at er.extensions.appserver.ajax.ERXAjaxApplication.<init>(ERXAjaxApplication.java:30)
> at er.extensions.appserver.ERXApplication.<init>(ERXApplication.java:816)
> at org.webcat.core.Application.<init>(Application.java:124)
> at net.sf.webcat.core.Application.<init>(Application.java:33)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> at java.lang.Class.newInstance0(Class.java:374)
> at java.lang.Class.newInstance(Class.java:327)
> at com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:642)
> ... 21 more
> -- --
> Is that the class com.webobjects.appserver.WOSessionStore cannot be
> found, or I am wrong?
>
>
> 2013/5/31 Theodore Petrosky <email@hidden>:
>> 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
--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
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