Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » MSSQL Integration(Error after MSSQL Integration)
MSSQL Integration [message #1862857] Wed, 03 January 2024 08:35 Go to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
Hello, I am really new to Eclipse Scout.
I created a new Scout Application and everything works fine.
Now, I added the MSSQL classes - and the following error occurs.
Please, can someone help me out?

public class MicrosoftSqlStyle extends AbstractSqlStyle {

	@Override
	public String getConcatOp() {
		return "+";
	}

	@Override
	public String getLikeWildcard() {
		return "%";
	}

	@Override
	protected int getMaxListSize() {
		return 1000;
	}

	@Override
	public boolean isLargeString(String s) {
		return (s.length() > 4000);
	}

	@Override
	public boolean isBlobEnabled() {
		return true;
	}

	@Override
	public boolean isClobEnabled() {
		return true;
	}

	@Override
	public String createDateTimeIsNow(String attribute) {
		return "TRUNC(" + attribute + ", 'MI')=TRUNC(SYSDATE, 'MI')";
	}

	@Override
	public String createDateTimeIsNotNow(String attribute) {
		return "TRUNC(" + attribute + ", 'MI')!=TRUNC(SYSDATE, 'MI')";
	}

	@Override
	public void testConnection(Connection conn) throws SQLException {
		Statement testStatement = null;
		try {
			testStatement = conn.createStatement();
			testStatement.execute("SELECT count(1) FROM dbo.sysobjects");
		} finally {
			if (testStatement != null)
				try {
					testStatement.close();
				} catch (Throwable t) {
				}
		}
	}
}


public class MSSqlService extends AbstractSqlService {

	@Override
	protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {
		return MicrosoftSqlStyle.class;
	}

	@Override
	protected String getConfiguredJdbcDriverName() {
		return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	}

	@Override
	protected String getConfiguredJdbcMappingName() {
		return "jdbc:sqlserver://localhost:1433;database=testdb;encrypt=false;";
	}

	@Override
	protected String getConfiguredUsername() {
		return "ADMIN";
	}

	@Override
	protected String getConfiguredPassword() {
		return "12345";
	}

}


Error:
2024-01-03 08:57:38,725 INFO [qtp1528923159-37] org.eclipse.scout.rt.ui.html.UiServlet.sendNotFound(UiServlet.java:282) - 404_NOT_FOUND: POST /process
2024-01-03 08:57:38,759 WARN [scout-thread-5 Tunneling service request [seq=2, submitter=ClientNotificationPoller]] org.eclipse.scout.rt.shared.http.ApacheMultiSessionCookieStore.addCookie(ApacheMultiSessionCookieStore.java:75) - adding cookie to default cookie store which could be used by other users too [cookie: [version: 0][name: JSESSIONID][value: node01clgxmgu9d8zu1oex2bc1c092t0.node0][domain: localhost][path: /][expiry: null]] - MDC[principal=notification-authenticator, jobName=Tunneling service request [seq=2, submitter=ClientNotificationPoller]]
2024-01-03 08:57:38,774 ERROR [scout-thread-4 ClientNotificationPoller] org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller.run(ClientNotificationPoller.java:156) - Error receiving client notifications [clientNodeId=8d82a793-bb8a-4d0f-ab1f-ab520ca56e5f] - MDC[principal=notification-authenticator, jobName=ClientNotificationPoller]
org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnelException: Service tunnel request failed with status code 404 [user=notification-authenticator, remote-service.name=org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService, remote-service.operation=getNotifications]
at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:82)
at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:1)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxMandatory(TransactionProcessor.java:155)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:138)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:37)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.job.internal.CallableChainExceptionHandler.intercept(CallableChainExceptionHandler.java:32)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.lambda$0(JobFutureTask.java:105)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:174)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:62)
at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:63)
at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:39)
at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.invokeService(HttpServiceTunnel.java:191)
at org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelProxyProducer.invoke(ServiceTunnelProxyProducer.java:50)
at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy.invokeImpl(DecoratingProxy.java:136)
at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy$P_InvocationHandler.invoke(DecoratingProxy.java:169)
at jdk.proxy2/jdk.proxy2.$Proxy22.getNotifications(Unknown Source)
at org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller$P_NotificationPoller.lambda$0(ClientNotificationPoller.java:144)
at org.eclipse.scout.rt.platform.util.concurrent.Callables.lambda$0(Callables.java:30)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxMandatory(TransactionProcessor.java:155)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:138)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:138)
at org.eclipse.scout.rt.platform.context.RunContext.run(RunContext.java:109)
at org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller$P_NotificationPoller.run(ClientNotificationPoller.java:141)
at org.eclipse.scout.rt.platform.util.concurrent.Callables.lambda$0(Callables.java:30)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.job.internal.ExceptionProcessor.intercept(ExceptionProcessor.java:40)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:226)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:112)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:141)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:77)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:157)
at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:37)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.job.internal.CallableChainExceptionHandler.intercept(CallableChainExceptionHandler.java:32)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:221)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:169)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.lambda$0(JobFutureTask.java:105)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:174)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:62)



This part works fine from within the project code:
public static void main(String[] args) {
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
        String connectionUrl =
                "jdbc:sqlserver://localhost:1433;"
                        + "database=testdb;"
                        + "user=ADMIN;"
                        + "password=12345;"
                        + "encrypt=false;";

        try (Connection connection = DriverManager.getConnection(connectionUrl);) {
            // Code here.
        	Statement statement = connection.createStatement();
        	
        	ResultSet result = statement.executeQuery("SELECT * FROM MYTABLE");
        	while(result.next()) {
        		System.out.println(result.getString(1));
        	}
        }
        // Handle any errors that may have occurred.
        catch (SQLException e) {
            e.printStackTrace();
        }
    }
Re: MSSQL Integration [message #1862859 is a reply to message #1862857] Wed, 03 January 2024 08:41 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Hi Ni ni

It seems that the backend server doesn't start properly, that's why the client notification poller receives a 404 when trying to access it. Can you check the backend server log? There should be the reason why the server cannot start.

Regards
Stephan

Re: MSSQL Integration [message #1862860 is a reply to message #1862857] Wed, 03 January 2024 08:42 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 55
Registered: August 2015
Location: Munich
Member
Are there any other exceptions (e.g. stack trace on backend server or other ones on frontend server)?
Re: MSSQL Integration [message #1862861 is a reply to message #1862860] Wed, 03 January 2024 08:47 Go to previous messageGo to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
Here is the server log:
2024-01-03 09:31:17,870 INFO [main] org.eclipse.scout.rt.platform.config.ConfigPropertyProvider.parse(ConfigPropertyProvider.java:115) - Reading properties from file:/C:/Users/.../target/classes/config.properties using org.eclipse.scout.rt.platform.config.DefaultConfigFileLoader
2024-01-03 09:31:17,905 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateHeadless(PlatformImplementor.java:174) - Headless mode: scout.headless=true, java.awt.headless=true (automatically set by Scout), GraphicsEnvironment.isHeadless()=true
2024-01-03 09:31:17,913 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:37) - Building jandex class inventory using rebuild strategy IF_MODIFIED...
2024-01-03 09:31:18,082 INFO [ForkJoinPool.commonPool-worker-7] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder.scanFolder(JandexInventoryBuilder.java:145) - Drop outdated index 'file:/C:/Users/.../target/classes/META-INF/jandex.idx'. Index timestamp 2024-01-03 09:06:19.392 is older than folder timestamp 2024-01-03 09:31:04.125.
2024-01-03 09:31:18,082 INFO [ForkJoinPool.commonPool-worker-7] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder.scanFolder(JandexInventoryBuilder.java:180) - Rebuild index 'file:/C:/Users/.../target/classes/META-INF/jandex.idx'. Scanning location...
2024-01-03 09:31:18,126 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:43) - Finished building jandex class inventory in 215.864700 ms. Total class count: 1529
2024-01-03 09:31:18,278 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:221) - Collected 364 beans in 150.979400 ms
2024-01-03 09:31:18,356 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:226) - Registered 364 beans in 77.553900 ms
2024-01-03 09:31:18,364 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.job.internal.DevelopmentThreadNameDecorator.stateChanged(DevelopmentThreadNameDecorator.java:87) - +++ Development thread name decoration
2024-01-03 09:31:18,373 INFO [scout-platform-starter] org.eclipse.scout.rt.platform.logger.LoggerInstallPlatformListener.registerLoggerSupportBean(LoggerInstallPlatformListener.java:98) - Registered logger support org.eclipse.scout.rt.platform.logger.LogbackLoggerSupport
2024-01-03 09:31:18,381 INFO [scout-platform-starter] org.eclipse.scout.rt.shared.services.common.code.CodeTypeRegistrator.stateChanged(CodeTypeRegistrator.java:41) - 0 code type classes registered.
2024-01-03 09:31:18,459 INFO [scout-platform-starter] org.eclipse.scout.rt.mom.api.AbstractMomTransport.initDelegate(AbstractMomTransport.java:98) - +++ Using 'NullMomImplementor' for transport 'ClusterMom'. No messages are published and received.
2024-01-03 09:31:18,674 INFO [main] org.eclipse.scout.dev.jetty.JettyServer.createContextHandler(JettyServer.java:214) - Starting Jetty with resourceBase=C:\Users\...\src\main\webapp
2024-01-03 09:31:18,722 INFO [main] org.eclipse.jetty.server.Server.doStart(Server.java:384) - jetty-10.0.17; built: 2023-10-09T18:22:21.150Z; git: af15f12297adf5c5083e1f2f8f4c5974438bca25; jvm 17.0.9+9
2024-01-03 09:31:18,940 INFO [main] org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitServlet(StandardDescriptorProcessor.java:274) - NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2024-01-03 09:31:18,956 INFO [main] org.eclipse.jetty.server.session.DefaultSessionIdManager.doStart(DefaultSessionIdManager.java:332) - Session workerName=node0
2024-01-03 09:31:19,009 INFO [main] org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:906) - Started o.e.s.d.j.P_WebAppContext@38234a38{... Server,/,file:///C:/Users/.../src/main/webapp/,AVAILABLE}{C:\Users\...\src\main\webapp}
2024-01-03 09:31:19,051 INFO [main] org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:376) - Started ServerConnector@2205a05d{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2024-01-03 09:31:19,055 INFO [main] org.eclipse.jetty.server.Server.doStart(Server.java:439) - Started Server@2fba3fc4{STARTING}[10.0.17,sto=0] @2136ms
2024-01-03 09:31:19,060 INFO [main] org.eclipse.scout.dev.jetty.JettyServer.logServerReady(JettyServer.java:159) - Server ready. The application is available on the following addresses:
---------------------------------------------------------------------
http://localhost:8080/
http://desktop:8080/
http://192.168.178.54:8080/
---------------------------------------------------------------------
To shut the server down, type "shutdown" in the console.
Re: MSSQL Integration [message #1862862 is a reply to message #1862861] Wed, 03 January 2024 08:50 Go to previous messageGo to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
there are no other error messages
Re: MSSQL Integration [message #1862863 is a reply to message #1862862] Wed, 03 January 2024 08:54 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Ni ni

Does the UI application work when accessing it in the browser?

Maybe the startup of the UI server was just faster than the backend server?
Does the error also occur if you start the backend server first and only start the UI server if the backend has been started successfully?

Kind regards
Mat
Re: MSSQL Integration [message #1862864 is a reply to message #1862863] Wed, 03 January 2024 08:59 Go to previous messageGo to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
Yes, the error occurs too, if i start the backend server first.
In the browser I get the following message:

[Updated on: Wed, 03 January 2024 09:01]

Report message to a moderator

Re: MSSQL Integration [message #1862866 is a reply to message #1862864] Wed, 03 January 2024 09:09 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Ni ni

If you remove your SQL service it works again?
What happens if you use org.eclipse.scout.rt.server.jdbc.mssql.AbstractMsSqlSqlService instead of your own implementation?
Do you have multiple Instances of ISqlService on your classpath? Maybe also a derby SqlService? What happens if you remove the unused implementations?

Kind regards
Mat
Re: MSSQL Integration [message #1862867 is a reply to message #1862866] Wed, 03 January 2024 09:20 Go to previous messageGo to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
Hi,
now I removed everything relating to the database connection and the error is still present. So I have to do research I think.
Re: MSSQL Integration [message #1862868 is a reply to message #1862867] Wed, 03 January 2024 09:22 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Your scout.backendUrl on the UI is correctly pointing to the address of your backend server?
Re: MSSQL Integration [message #1862870 is a reply to message #1862868] Wed, 03 January 2024 09:40 Go to previous messageGo to next message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
Thats it. I'm so sorry I was so stupid. THANK YOU VERY MUCH!
Is there a tutorial how to use the org.eclipse.scout.rt.server.jdbc.mssql.AbstractMsSqlSqlService or do I have to copy the code from here? ->
https://git.eclipse.org/r/plugins/gitiles/scout/org.eclipse.scout.rt/+/d4a5bb42cde41a76756fe34c5bb66a3673659016/org.eclipse.scout.rt.server.jdbc/src/main/java/org/eclipse/scout/rt/server/jdbc/mssql/AbstractMsSqlSqlService.java
Re: MSSQL Integration [message #1862871 is a reply to message #1862870] Wed, 03 January 2024 09:43 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
I don't think there is a tutorial.

Basically you just have to create a new class extending AbstractMsSqlSqlService (instead of AbstractSqlService) and overwriting the necessary methods (basically getConfiguredJdbcMappingName) as you did it with your own class.

Hope this helps
Mat
Re: MSSQL Integration [message #1862873 is a reply to message #1862871] Wed, 03 January 2024 10:46 Go to previous message
Ni ni is currently offline Ni niFriend
Messages: 15
Registered: January 2024
Junior Member
It works! Again, thank you very much for your help!
Previous Topic:Log output change after migrating from Scout 22 to 23.2
Next Topic:Timezones
Goto Forum:
  


Current Time: Wed May 08 09:02:07 GMT 2024

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

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

Back to the top