Re: WO doesn´t find correct "Session" class
Re: WO doesn´t find correct "Session" class
- Subject: Re: WO doesn´t find correct "Session" class
- From: Chuck Hill <email@hidden>
- Date: Wed, 11 Oct 2006 13:03:39 -0700
Something seems odd here. The docs state:
The method goes through several steps to locate the class to use
for instantiating this object:
First it looks for a class of name "Session" that is a subclass of
WOSession and is in the same package as the subclass of
WOApplication being used.
If such a class does not exist, it uses WOSession.
IIRC, that is how it actually works (e.g. the docs are not inaccurate
here).
I suspect that something is wrong with:
/Library/WebObjects/Applications/Prontuario.woa/Contents/Resources/
Java/prontuario.jar
1. This jar can't be loaded / is not there
2. This jar does not contain the WOSession sub-class
3. The WOSession sub-class is not actually in the same package as the
WOApplication sub-class, which may imply that it is not picking up
the correct WOApplication sub-class, so back to point 2, but about
the WOApplication sub-class.
4. Also check that the main method in Application is using the
correct class:
public static void main(String argv[])
{
WOApplication.main(argv, Application.class);
}
Launching is directory dependent. To launch from the command line,
you need to
cd Prontuario.woa
./Prontuario
Otherwise it will use classes from JavaWebObjects.framework and then
it may well load the Mail session.
Chuck
On Oct 11, 2006, at 12:43 PM, Mike Schrag wrote:
When you are embedding frameworks, the order of the classes in the
applications NSBundle is effectively random (at this point,
anyway). I'm guessing this is what you're seeing. The order of
classloading with embedding does not respect classpath ordering. I
just stumbled onto this exact problem yesterday with "Main" getting
loaded from ERIMAdaptor when I embedded the Wonder frameworks.
You might be able to cheat with _NSUtilities.setClassForName
(MySession.class, "Session"); as a stop-gap. We need to address
this "officially", though and see if it's possible to change the
way NSBundle stores that order.
On Oct 11, 2006, at 3:08 PM, Georg von Bülow wrote:
Hi,
I get the following strange error message when trying to run
a .woa through terminal (or JavaMonitor).
/java.lang.IllegalArgumentException:
<br.nist.nust.prontuario.basico.Application> Class 'Session'
exists (class javax.mail.Session) but is not a subclass of
WOSession.../
True, there is a Session.class in ERJavaMail, which I use as an
embedded Framework. But the generated classpath looks quite
normal, i.e. first appears the jar of the application (Prontuario)
and later the one of the embedded frameworks:
/Generated classpath:
/Library/WebObjects/Applications/Prontuario.woa/Contents/
Resources/Java/prontuario.jar
...[more stuff]
/Library/WebObjects/Applications/Prontuario.woa/Contents/
Frameworks/Library/Frameworks/ERJavaMail.framework/Resources/Java/
mail-1.3.jar
...[more stuff]/
My Session class is in the same package as my Application
(br.nist.nust.prontuario.basico). Any idea why WOApplication looks
up Session.class from the Framework? Shouldn´t it look first in
the same package as my Application.class is? Should I configure
this somewhere??
Now what confuses me even more, is that I have a quite similiar
app which also uses ERJavaMail and runs whithout problems. I
checked and compared the two apps many times but I didn´t see any
obvious differences which could explain this (the other app
(Acidente) has an acidente.jar and the Application.class is in the
package br.nist.acidente.basico).
I´m using WO 5.3.1/Mac, and build with WOLips. Ah, and I use WONDER.
Any hint would be greatly apreciated, I´m just running out of
ideas...
Thanks in advance,
Georg
--
\o/ Georg von Bülow, Moleque de Idéias Educação e Tecnologia Ltda
| Phone: 55-21-2710-0178 E-mail: email@hidden
/ \ http://www.moleque.com.br Niterói - Rio de Janeiro - Brasil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com
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:
40global-village.net
This email sent to email@hidden
--
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/products/practical_webobjects
_______________________________________________
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