Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Multiple instances found error..
Multiple instances found error.. [message #1739332] Fri, 29 July 2016 20:49 Go to next message
Luka Cavic is currently offline Luka CavicFriend
Messages: 25
Registered: August 2014
Junior Member
Hi I have this error, data from database is not showing..

Etc. I have UsersService that implements IUsersService

I have added that UsersService extens PostgreSqlService and that service is extending main AbstractPostgreSqlService from Maven...

For some time that was working, but now not. The same error is when fetching table data and inserting and selecting...

This is error:

2016-07-29 22:43:37,637 ERROR [qtp731395981-16] org.eclipse.scout.rt.platform.exception.ExceptionHandler.handlePlatformException(ExceptionHandler.java:110) - - MDC[principal=Luka, cid=HQ5SC8zb6Yu/4]
org.eclipse.scout.rt.platform.util.Assertions$AssertionException: Assertion error: multiple instances found for query: interface org.eclipse.scout.rt.server.jdbc.ISqlService [IBean[@ApplicationScoped com.rinels.epodrska.server.settings.UsersService], IBean[@ApplicationScoped com.rinels.epodrska.server.settings.UsersTituleService]] [user=Luka, service.name=com.rinels.epodrska.shared.settings.IUsersService, service.operation=getUsersTableData]
at org.eclipse.scout.rt.platform.util.Assertions.fail(Assertions.java:580)
at org.eclipse.scout.rt.platform.internal.BeanManagerImplementor.optBean(BeanManagerImplementor.java:222)
at org.eclipse.scout.rt.platform.BEANS.opt(BEANS.java:55)
at org.eclipse.scout.rt.platform.BEANS.get(BEANS.java:41)
at org.eclipse.scout.rt.server.jdbc.SQL.selectInto(SQL.java:109)
at com.rinels.epodrska.server.settings.UsersService.getUsersTableData(UsersService.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.scout.rt.shared.servicetunnel.ServiceUtility.invoke(ServiceUtility.java:54)
at org.eclipse.scout.rt.server.ServiceOperationInvoker.invokeInternal(ServiceOperationInvoker.java:101)
at org.eclipse.scout.rt.server.ServiceOperationInvoker$1.call(ServiceOperationInvoker.java:62)
at org.eclipse.scout.rt.server.ServiceOperationInvoker$1.call(ServiceOperationInvoker.java:1)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
at org.eclipse.scout.rt.server.context.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:80)
at org.eclipse.scout.rt.server.context.TransactionProcessor.intercept(TransactionProcessor.java:55)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:121)
at org.eclipse.scout.rt.server.ServiceOperationInvoker.invoke(ServiceOperationInvoker.java:58)
at org.eclipse.scout.rt.server.ServiceTunnelServlet.invokeService(ServiceTunnelServlet.java:193)
at org.eclipse.scout.rt.server.ServiceTunnelServlet.doPost(ServiceTunnelServlet.java:149)
at org.eclipse.scout.rt.server.ServiceTunnelServlet$2.run(ServiceTunnelServlet.java:117)
at org.eclipse.scout.rt.platform.util.concurrent.Callables$1.call(Callables.java:37)
at org.eclipse.scout.rt.platform.util.concurrent.Callables$1.call(Callables.java:1)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:121)
at org.eclipse.scout.rt.platform.context.RunContext.run(RunContext.java:87)
at org.eclipse.scout.rt.server.ServiceTunnelServlet.doPost(ServiceTunnelServlet.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper$1.run(ServletFilterHelper.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper.continueChainAsSubject(ServletFilterHelper.java:155)
at org.eclipse.scout.rt.server.commons.authentication.ServiceTunnelAccessTokenAccessController.handle(ServiceTunnelAccessTokenAccessController.java:90)
at com.rinels.epodrska.server.ServerServletFilter.doFilter(ServerServletFilter.java:50)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Unknown Source)
Re: Multiple instances found error.. [message #1739336 is a reply to message #1739332] Fri, 29 July 2016 21:51 Go to previous messageGo to next message
Luka Cavic is currently offline Luka CavicFriend
Messages: 25
Registered: August 2014
Junior Member
solved it...
added @Order(1000) below service..
Re: Multiple instances found error.. [message #1739527 is a reply to message #1739336] Tue, 02 August 2016 16:52 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 87
Registered: November 2010
Member
Luka Cavic wrote on Fri, 29 July 2016 17:51
solved it...
added @Order(1000) below service..


Great!

Apparently you had two beans with the same order in your application that implemented the same interface "ISqlService". The bean manager could not decide, which one to use, so it threw an exception. If you omit the order, your bean gets assigned the default order, which is 5000. So adding an @Order annotation with a lower number in your own projects to override default beans from Scout is the correct way to do it.

Regards,
Beat
Re: Multiple instances found error.. [message #1739949 is a reply to message #1739527] Fri, 05 August 2016 20:24 Go to previous messageGo to next message
Luka Cavic is currently offline Luka CavicFriend
Messages: 25
Registered: August 2014
Junior Member
Hi, how to solve it by not adding order below service?
Now, I have many services, but only one service extends MainPostgreService(where is db connection methods) and has order below class name
Re: Multiple instances found error.. [message #1740271 is a reply to message #1739949] Thu, 11 August 2016 06:23 Go to previous message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 87
Registered: November 2010
Member
Luka Cavic wrote on Fri, 05 August 2016 16:24
Hi, how to solve it by not adding order below service?
Now, I have many services, but only one service extends MainPostgreService(where is db connection methods) and has order below class name


When you don't add the @Order annotation, your bean gets assigned the default order of 5000. This is fine, as long as only one bean of a specific type exists. If more than one exists, you have to assign distinct orders to them. Alternatively, you can replace the bean from which you extend by adding the @Replace annotation.

See this section of the Scout documentation:
http://eclipsescout.github.io/6.0/technical-guide.html#bean-retrieval

Regards,
Beat

Previous Topic:AbstractPageWithNodes with default page
Next Topic:DataSourceCredentialVerifier
Goto Forum:
  


Current Time: Sun Jun 25 14:10:33 GMT 2017

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

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