catch Exception fails [message #303063] |
Mon, 08 May 2006 08:02  |
Eclipse User |
|
|
|
Hi!
I've written my own exception called "my.LoginException".
Now I've got a server (JBoss with EJB3) and a domain object called
"UserManager".
When I throw the "my.LoginException" in the server object "UserManager" like
this:
[common]
public class LoginException extends Exception {
....
}
@Remote
public interface IUserManager {
void isValid(LoginData);
}
[server jboss ejb3]
@Stateless
public class UserManager implements IUserManager {
public void isValid(LoginData) throws my.LoginException {
throw new my.LoginException();
}
}
and catch it like this:
[rcp client]
try {
UserManager usermgr = new UserManager();
usermgr.isValid(...);
} catch (my.LoginException e) {
print(e);
}
I can not catch the "my.LoginExcpetion" because the thrown exception is no
instance of a "my.LoginException".
I tried "e instanceof my.LoginException", this failed.
The debugger tells me that the thrown exception object "e" is a
my.LoginException!
When I call "e.getClass()" the system writes: "class my.LoginException".
So, the thrown exception object IS A "my.LoginException", but at runtime it
falls through the catch block.
Has anyone an idea? Is the eclipse classloading the error?
Thx, Christian
|
|
|
|
|
Re: catch Exception fails [message #303100 is a reply to message #303070] |
Tue, 09 May 2006 01:36  |
Eclipse User |
|
|
|
Got it!
The clue was, that I had two plugins which had the same jar wrapped (and
others of course). I removed the jar in plugin A and made a dependency to
plugin B. Thus the is not loaded twice.
"Christian Gesswagner" <christian.gesswagner@ams-engineering.com> schrieb im
Newsbeitrag news:e3ng3d$4ku$1@utils.eclipse.org...
> You are right, this JAR is wrapped by a plugin which is shared with
others.
>
> "Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag
> news:e3nekp$ti6$1@utils.eclipse.org...
> > Christian,
> >
> > It sounds like you've got things set up so that more than one instance
> > of the same class is being loaded. Have you put this class in a jar
> > that's in a plugin which allows this jar to be shared with other
plugins?
> >
> >
> > Christian Gesswagner wrote:
> >
> > >Hi!
> > >
> > >I've written my own exception called "my.LoginException".
> > >
> > >Now I've got a server (JBoss with EJB3) and a domain object called
> > >"UserManager".
> > >
> > >When I throw the "my.LoginException" in the server object "UserManager"
> like
> > >this:
> > >
> > >[common]
> > >public class LoginException extends Exception {
> > >...
> > >}
> > >
> > >@Remote
> > >public interface IUserManager {
> > > void isValid(LoginData);
> > >}
> > >
> > >[server jboss ejb3]
> > >@Stateless
> > >public class UserManager implements IUserManager {
> > >
> > >public void isValid(LoginData) throws my.LoginException {
> > > throw new my.LoginException();
> > >}
> > >
> > >}
> > >
> > >and catch it like this:
> > >
> > >[rcp client]
> > >try {
> > > UserManager usermgr = new UserManager();
> > > usermgr.isValid(...);
> > >} catch (my.LoginException e) {
> > > print(e);
> > >}
> > >
> > >I can not catch the "my.LoginExcpetion" because the thrown exception is
> no
> > >instance of a "my.LoginException".
> > >
> > >I tried "e instanceof my.LoginException", this failed.
> > >The debugger tells me that the thrown exception object "e" is a
> > >my.LoginException!
> > >When I call "e.getClass()" the system writes: "class
my.LoginException".
> > >
> > >So, the thrown exception object IS A "my.LoginException", but at
runtime
> it
> > >falls through the catch block.
> > >
> > >Has anyone an idea? Is the eclipse classloading the error?
> > >
> > >Thx, Christian
> > >
> > >
> > >
> > >
>
>
|
|
|
Powered by
FUDForum. Page generated in 1.06363 seconds