[ome-users] Checking a false login
josh.moore at gmx.de
josh.moore at gmx.de
Wed Nov 28 09:18:15 GMT 2007
Matthias Dunda writes:
> Hi all!
Hi Matthias.
> I'm new to this group and trying to get into this omero stuff...
Then first of all welcome, and let's see if we can't make things a bit simpler.
> Right now I'm using this example to start from:
>
> http://trac.openmicroscopy.org.uk/omero/wiki/examples/ExampleOne
Have you also looked at:
https://trac.openmicroscopy.org.uk/omero/wiki/OmeroClientLibrary
since it looks like something may be missing from your
classpath. Alternatively, perhaps it has something to do with JNI
judging from the end of your stack trace. Could you explain a little
about your setup?
> What I'd like to ask is how can I check for a false login? When I
> run the code providing a wrong login/pass I get some very strange
> exceptions, from witch I would never think of that is only the
> login being wrong:
In the JavaEE world, unfortunately, there's not a single login check
since you are authenticated on every method call. This will be
changing soon since we are rewriting the login infrastructure, but for the
moment this is the state of things.
The non-null proxy which gets returned from ServiceFactory handles the
authentication. Therefore, the best idiom for testing login then is to
do as you did and try to make a method call. A simple one is:
try {
ServiceFactory sf = new ServiceFactory();
sf.getConfigService().getServerTime();
} catch (...) {
//
}
The exceptions which can be thrown from a functioning server should be
only: javax.ejb.EJBAccessException or a subclass of
ome.conditions.RootException. See
http://cvs.openmicroscopy.org.uk/tiki/tiki-index.php?page=Omero+Exception+Handling
for more information.
> ----snip----
> Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
> at $Proxy14.saveAndReturnObject(Unknown Source)
> 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:597)
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:280)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:199)
> at $Proxy7.saveAndReturnObject(Unknown Source)
> at examples.Example01.main(Example01.java:34)
> Caused by: java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
> at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
> at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
> at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
> at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
> at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
> at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
> at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
> at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
> at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
> at org.jboss.remoting.Client.invoke(Client.java:525)
> at org.jboss.remoting.Client.invoke(Client.java:488)
> at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
> at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
> at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
> at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
> at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
> at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
> at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
> at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
> at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
> ... 9 more
> ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
> JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
> ----snip----
>
> I didn't find something on the ServiceFactory like isValidLogin or isLoggedIn or something... I even get a not-null IUpdate from getUpdateService() although the login was wrong...
>
> Any suggestions? Are there more examples available?
There aren't other annotated "hello world" examples like ExampleOne,
but there are a number of tests you might take a look at for
reference:
https://trac.openmicroscopy.org.uk/omero/browser/trunk/components/client/test/ome/client/itests
> Cheers!
> Matthias
Best wishes,
~Josh.
> --
> Matthias Dunda, Dipl.-Inform.
> c.a.r.u.s. HMS GmbH
> Bornbarch 9, D-22848 Norderstedt
> Fon: +49.(0)40.5 14 35-0
> Fax: +49.(0)40.5 14 35-1111
>
> Amtsgericht/Register Court: Kiel, HRB 4587 NO
> Sitz/Registered Office: Norderstedt
> Geschäftsführer/Managing Directors: Karl-Heinz Witt, Dr. Matthias Rath
More information about the ome-users
mailing list