Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » catch Exception fails
catch Exception fails [message #303063] Mon, 08 May 2006 08:02 Go to next message
Eclipse UserFriend
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 #303067 is a reply to message #303063] Mon, 08 May 2006 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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
>
>
>
>
Re: catch Exception fails [message #303070 is a reply to message #303067] Mon, 08 May 2006 09:12 Go to previous messageGo to next message
Eclipse UserFriend
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
> >
> >
> >
> >
Re: catch Exception fails [message #303100 is a reply to message #303070] Tue, 09 May 2006 01:36 Go to previous message
Eclipse UserFriend
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
> > >
> > >
> > >
> > >
>
>
Previous Topic:Eclipse Won't Start on Intel based Mac OsX
Next Topic:How to prevent Properties View listening to my View?
Goto Forum:
  


Current Time: Thu Jul 17 11:05:55 EDT 2025

Powered by FUDForum. Page generated in 0.49567 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top