We're Hiring!

Connecting with Java API problem

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Connecting with Java API problem

Postby chriswood » Wed Aug 29, 2012 6:41 pm

Hi,

On my local Mac, I have installed omero server and it is runs fine. I am able to connect with Insight, omero.web, and python BlitzGateway. I can connect over the network to my Mac with Insight.

I have written a java program that will not connect to my local machine. It works fine connecting to a server over the network, while other computers cannot connect to my mac using this code.

Everything should be using omero 4.4.1 and ice 3.3.
(The same insight client can connect to both the network server and local server)

It gives a 'Password check failed", but I don't think the password is the problem.

Here is the connection code I am using:
Code: Select all
public void connectOmero(String user, String password, String host, String group) {
      this.host = host;
      Map<String, String> map = new java.util.HashMap<String, String>();
      map.put("omero.host", host);
      map.put("omero.user", user);
      map.put("omero.password", password);
      map.put("omero.group", group);
      map.put("omero.port", "4064");
      
      try {
         omeroClient = new omero.client(map);
         service = omeroClient.createSession();
         service.closeOnDestroy();
      }
      
      catch (CannotCreateSessionException e) {
         e.printStackTrace();
      }
      
      catch (ServerError e) {
         e.printStackTrace();         
      }
      catch (PermissionDeniedException e) {
         e.printStackTrace();
      }
   }


Here is the stack trace
Code: Select all
Glacier2.PermissionDeniedException
    reason = "Password check failed for 'cjw': [id=2]"
No connection
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at java.lang.Class.newInstance0(Class.java:355)
   at java.lang.Class.newInstance(Class.java:308)
   at IceInternal.BasicStream$DynamicUserExceptionFactory.createAndThrow(BasicStream.java:2243)
   at IceInternal.BasicStream.throwException(BasicStream.java:1632)
   at IceInternal.Outgoing.throwUserException(Outgoing.java:442)
   at Glacier2._RouterDelM.createSession(_RouterDelM.java:42)
   at Glacier2.RouterPrxHelper.createSession(RouterPrxHelper.java:51)
   at Glacier2.RouterPrxHelper.createSession(RouterPrxHelper.java:29)
   at omero.client.createSession(client.java:627)
   at omero.client.createSession(client.java:565)
   at screenimporter.omeroConnection.connectOmero(omeroConnection.java:31)
   at screenimporter.omeroConnection.<init>(omeroConnection.java:17)
   at screenimporter.platetest.main(platetest.java:16)



Here is info from the Blitz log:
Code: Select all
2012-08-29 13:20:01,586 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Executor.doWork -- ome.services.sessions.SessionManagerImpl.executeCheckPasswordRO(cjw)
2012-08-29 13:20:01,586 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Args:   [null, InternalSF@1506785356]
2012-08-29 13:20:01,589 INFO  [         ome.security.basic.EventHandler] (l.Server-6)  Auth:   user=0,group=0,event=null(Sessions),sess=6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6
2012-08-29 13:20:01,591 WARN  [  ome.security.auth.LoginAttemptListener] (l.Server-6) 3 failed logins for cjw. Throttling for 3000
2012-08-29 13:20:04,592 INFO  [                 org.perf4j.TimingLogger] (l.Server-6) start[1346264401586] time[3006] tag[omero.call.success.ome.services.sessions.SessionManagerImpl$8.doWork]
2012-08-29 13:20:04,592 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Rslt:   false
2012-08-29 13:20:04,592 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Executor.doWork -- java.lang.String.cjw
2012-08-29 13:20:04,592 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Args:   [null, InternalSF@1506785356]
2012-08-29 13:20:04,594 INFO  [         ome.security.basic.EventHandler] (l.Server-6)  Auth:   user=0,group=0,event=null(Internal),sess=6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6
2012-08-29 13:20:04,598 INFO  [                 org.perf4j.TimingLogger] (l.Server-6) start[1346264404592] time[6] tag[omero.call.success.ome.services.blitz.fire.PermissionsVerifierI$1.doWork]
2012-08-29 13:20:04,598 INFO  [        ome.services.util.ServiceHandler] (l.Server-6)  Rslt:   null
2012-08-29 13:20:04,813 INFO  [ome.services.sessions.state.SessionCache] (2-thread-1) Synchronizing session cache. Count = 3
2012-08-29 13:20:04,814 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Executor.doWork -- ome.services.sessions.SessionManagerImpl.reload(660dc404-6150-4298-b02a-6dad17f935f9)
2012-08-29 13:20:04,814 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Args:   [null, InternalSF@1506785356]
2012-08-29 13:20:04,818 INFO  [         ome.security.basic.EventHandler] (2-thread-1)  Auth:   user=0,group=0,event=null(Sessions),sess=6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6
2012-08-29 13:20:04,829 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1346264404814] time[15] tag[omero.call.success.ome.services.sessions.SessionManagerImpl$6.doWork]
2012-08-29 13:20:04,829 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Rslt:   (ome.model.meta.Experimenter:Id_0, ome.model.meta.ExperimenterGroup:Id_0, (0, 1, 3), ... 4 more)
2012-08-29 13:20:04,830 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Executor.doWork -- ome.services.sessions.SessionManagerImpl.reload(0b421ac6-e66b-41bd-aab5-71bb3fa40336)
2012-08-29 13:20:04,830 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Args:   [null, InternalSF@1506785356]
2012-08-29 13:20:04,838 INFO  [         ome.security.basic.EventHandler] (2-thread-1)  Auth:   user=0,group=0,event=null(Sessions),sess=6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6
2012-08-29 13:20:04,842 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1346264404830] time[12] tag[omero.call.success.ome.services.sessions.SessionManagerImpl$6.doWork]
2012-08-29 13:20:04,842 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Rslt:   (ome.model.meta.Experimenter:Id_0, ome.model.meta.ExperimenterGroup:Id_0, (0, 1, 3), ... 4 more)
2012-08-29 13:20:04,842 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Executor.doWork -- ome.services.sessions.SessionManagerImpl.reload(6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6)
2012-08-29 13:20:04,842 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Args:   [null, InternalSF@1506785356]
2012-08-29 13:20:04,845 INFO  [         ome.security.basic.EventHandler] (2-thread-1)  Auth:   user=0,group=0,event=null(Sessions),sess=6e15d5c9-0ad5-4374-9e1e-996cf3cdbdf6
2012-08-29 13:20:04,853 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1346264404842] time[11] tag[omero.call.success.ome.services.sessions.SessionManagerImpl$6.doWork]
2012-08-29 13:20:04,853 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Rslt:   (ome.model.meta.Experimenter:Id_0, ome.model.meta.ExperimenterGroup:Id_0, (0, 1, 3), ... 4 more)
2012-08-29 13:20:04,853 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1346264404813] time[40] tag[omero.sessions.synchronization]
2012-08-29 13:20:04,853 INFO  [ome.services.sessions.state.SessionCache] (2-thread-1) Synchronization took 40 ms.
chriswood
 
Posts: 25
Joined: Wed Apr 07, 2010 8:28 pm

Re: Connecting with Java API problem

Postby jmoore » Thu Aug 30, 2012 6:30 am

Can you try "omero.pass" rather than "omero.password"? If you want, these values are defined in Constants.ice:

Code: Select all
    // User context for logging in
    const string USERNAME = "omero.user";
    const string PASSWORD = "omero.pass";
    const string GROUP    = "omero.group";
    const string EVENT    = "omero.event";
    const string AGENT    = "omero.agent";


Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Connecting with Java API problem

Postby chriswood » Thu Aug 30, 2012 2:02 pm

Thanks Josh, that works.

So my question now is, why can I login to our omero server on the network with the wrong password field in the map? I passed '' as the password for a user that is not me, and I was logged in.

Here is a link to an issue we had before with ldap (you wrote an extension for handling our usernames):
http://lists.openmicroscopy.org.uk/pipermail/ome-users/2011-September/002809.html

I copied the jar file over to the 4.4.1 installation and set the configuration; it didn't look like the issue was resolved.

Thanks,
Chris
chriswood
 
Posts: 25
Joined: Wed Apr 07, 2010 8:28 pm

Re: Connecting with Java API problem

Postby jmoore » Fri Aug 31, 2012 12:35 pm

Chris,

this is in fact the same issue we had with OMERO 4.3.x. A new release (4.4.3) is available to correct the problem, see:


Thanks for pointing this out!
~Josh

P.S. You should no longer need to use the extensions.jar from 4.3.x. The password is available in the vanilla install as "chainedPasswordProvider431".
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Connecting with Java API problem

Postby chriswood » Thu Sep 06, 2012 2:17 pm

Thanks Josh,

The vanilla install works perfectly.

Chris
chriswood
 
Posts: 25
Joined: Wed Apr 07, 2010 8:28 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests