UndeclaredThrowableException on client when recevieng Faile
michaelkonietzka Jul 14, 2005 8:52 AMWhen my client tries to access a secured EJB with wrong credentials, the server throws a FailedLoginException as expected. But then the client throws UndeclaredThrowableException, because the method signature doesn't know anything about LoginException.
From my point of view, the container has to wrap the LoginException into a RuntimeException,
but it seems it does not. In the EJB 2.1 spec:
"21.6.9 Runtime Security Enforcement
[..]
11/12/03 490 If the container denies a client access to a business method, the container must throw the java.rmi.RemoteException (or its sub class, the java.rmi.AccessException) to the client if the client is a remote client, or the javax.ejb.EJBException (or its subclass, the javax.ejb.AccessLocalException) if the client is a local client.
"
System is JBoss-4.0.2 on Linux, with CustomLoginModule extends UsernamePasswordLoginModule
Best regards
Michael
Example StackTrace:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at de.schlund.shop3.util.ServiceLocator.createEJBObject(ServiceLocator.java:90)
at de.schlund.shop3.util.ServiceLocator.createEJBObject(ServiceLocator.java:69)
at de.schlund.shop3.proxy.UserProxy.getRemote(UserProxy.java:44)
at de.schlund.shop3.proxy.UserProxy.getRoles(UserProxy.java:56)
at de.schlund.shop3config.login.LoginHelper.login(LoginHelper.java:27)
...
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy1.create(Unknown Source)
... 50 more
Caused by: javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)