Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Easiest way to run the UI on computer
Easiest way to run the UI on computer [message #1861843] Wed, 08 November 2023 01:05 Go to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Currently, I have an Eclipse Scout application (UI + server) deployed on a remote Tomcat server.

For specific development needs, I need to run the client part of my application locally on a computer.
I need this application to continue to access the server part on the remote Tomcat server.

I tried to implement an embedded Tomcat for the ui.html.war project:

public class EmbeddedTomcat {
    public static void main(String[] args) throws Exception {
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8082);

        String webappDirLocation = "src/main/webapp/";
        StandardContext ctx = (StandardContext) tomcat.addWebapp("", new File(webappDirLocation).getAbsolutePath());

        // Other configurations

        tomcat.start();
        tomcat.getServer().await();
    }
}


I no longer have any errors in the console, but I can't access my application via localhost:8082

I tried to explore the JettyServer option, but I lack the necessary knowledge.

What is the easiest way to achieve my goal?

EDIT : of course I know I can install a local tomcat on my pc, deploy the client etc. But in the end it is directed to my final users, so I want to create a one-click button to launch the client, so I need something embedded.

Thank you

[Updated on: Wed, 08 November 2023 01:07]

Report message to a moderator

Re: Easiest way to run the UI on computer [message #1861854 is a reply to message #1861843] Wed, 08 November 2023 08:23 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 55
Registered: August 2015
Location: Munich
Member
Can you start the client application locally from your IDE? You may be able to take a look how it is started there (and maybe copy/paste from there), starting from the IDE usually a Jetty server with a main method should be used.
Re: Easiest way to run the UI on computer [message #1862232 is a reply to message #1861854] Sun, 19 November 2023 23:26 Go to previous messageGo to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Hello, thank you for your suggestion. Apologies for my delayed response.

I've been experimenting with the Jetty method and here's what I've done so far:

I copied the JettyServer class from org.eclipse.scout.dev.jetty into my project at myproject.ui.html.app.dev.

Running it manually from Eclipse seems successful it launches my client on localhost:8080 and successfully connects to the remote server's war file.

To build a jar, I've updated the pom.xml in my ui.html.app.dev project as follows:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <archive>
                <manifest>
                    <mainClass>
                        snippet.JettyServer
                    </mainClass>
                </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </execution>
    </executions>
</plugin>


This modification successfully builds the jar. However, when I attempt to run it, I encounter an error: the config.properties file cannot be read, even though it's correctly placed in src/main/resources. I've also tried moving the config.properties file to the same location as the .jar, but this hasn't resolved the issue.

(I have also extracted the jar and the config.properties seems to be correctly put in it)

I am getting closer but I definitely need your advices here

java -jar project.ui.html.app.dev-1.0.0-SNAPSHOT-jar-with-dependencies.jar
2023-11-20 00:21:47,083 INFO  [main] org.eclipse.scout.rt.platform.config.ConfigPropertyProvider.parse(ConfigPropertyProvider.java:115) - Reading properties from jar:file:/.../target/project.ui.html.app.dev-1.0.0-SNAPSHOT-jar-with-dependencies.jar!/config.properties using org.eclipse.scout.rt.platform.config.DefaultConfigFileLoader
2023-11-20 00:21:47,112 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
2023-11-20 00:21:47,117 INFO  [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:37) - Building jandex class inventory using rebuild strategy IF_MISSING...
2023-11-20 00:21:47,136 INFO  [scout-platform-starter] org.eclipse.scout.rt.platform.inventory.ClassInventory.<clinit>(ClassInventory.java:43) - Finished building jandex class inventory in 22.610781 ms. Total class count: 12
2023-11-20 00:21:47,139 INFO  [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:221) - Collected 0 beans in 1.550395 ms
2023-11-20 00:21:47,139 INFO  [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.createBeanManager(PlatformImplementor.java:226) - Registered 0 beans in 0.259599 ms
2023-11-20 00:21:47,142 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.application.name' does not exist or has an invalid value.
2023-11-20 00:21:47,142 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.devMode' does not exist or has an invalid value.
2023-11-20 00:21:47,142 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.auth.privateKey' does not exist or has an invalid value.
2023-11-20 00:21:47,142 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.cspEnabled' does not exist or has an invalid value.
2023-11-20 00:21:47,142 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.application.version' does not exist or has an invalid value.
2023-11-20 00:21:47,143 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.client.userArea' does not exist or has an invalid value.
2023-11-20 00:21:47,143 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.auth.cookieSessionValidateSecure' does not exist or has an invalid value.
2023-11-20 00:21:47,144 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.cspDirective[img-src]' does not exist or has an invalid value.
2023-11-20 00:21:47,144 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:194) - Config property with key 'scout.backendUrl' does not exist or has an invalid value.
2023-11-20 00:21:47,144 ERROR [scout-platform-starter] org.eclipse.scout.rt.platform.internal.PlatformImplementor.start(PlatformImplementor.java:146) - Error during platform startup
org.eclipse.scout.rt.platform.exception.PlatformException: Cannot start platform due to 9 invalid config properties: [scout.application.name, scout.devMode, scout.auth.privateKey, scout.cspEnabled, scout.application.version, scout.client.userArea, scout.auth.cookieSessionValidateSecure, scout.cspDirective[img-src], scout.backendUrl]
        at org.eclipse.scout.rt.platform.internal.PlatformImplementor.validateConfiguration(PlatformImplementor.java:198)
        at org.eclipse.scout.rt.platform.internal.PlatformImplementor.start(PlatformImplementor.java:139)
        at org.eclipse.scout.rt.platform.internal.PlatformStarter.run(PlatformStarter.java:29)

[Updated on: Sun, 19 November 2023 23:33]

Report message to a moderator

Re: Easiest way to run the UI on computer [message #1862326 is a reply to message #1862232] Sun, 26 November 2023 00:40 Go to previous messageGo to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Hello, I take the liberty of reiterating my question and hope anybody can provide a tip, as I can't find a way to do it.
Re: Easiest way to run the UI on computer [message #1862342 is a reply to message #1862326] Mon, 27 November 2023 11:00 Go to previous messageGo to next message
J D is currently offline J DFriend
Messages: 100
Registered: February 2021
Senior Member
Hi there,

Have you tried editing the "service tunnel" section of the config.properties file in your xxx. ui.html.app.dev package? Since the value of the "scout.backendUrl" property is "http://localhost:8080", changing it to the address of your remote Tomcat production server, might just work. for you. I've never tried it though. It is just a suggestion for you to try out.

### Service tunnel
scout.backendUrl=http://localhost:8080
scout.auth.privateKey=xYzxYZ


Cheers,

JD

[Updated on: Mon, 27 November 2023 11:01]

Report message to a moderator

Re: Easiest way to run the UI on computer [message #1862433 is a reply to message #1862342] Mon, 04 December 2023 23:45 Go to previous messageGo to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Hello JD, thank you for your suggestions but I am further in my experiment I already figured that I can change this URL.

My issue is to load the config.properties file. I have tried using the -Dscout.env=file:linktoconfig.properties but it still try to load the original config.properties

I have just noticed there is a new commit in the framework : "Scout Application (Jetty): improve for using in non-development mode" : https://github.com/eclipse-scout/scout.docs/commit/1d14684721be6e654246055c8f9d27330045bbee

Seems like somebody accomplished something I am trying to do. I don't know how to make work, I am in 23.9
Re: Easiest way to run the UI on computer [message #1863489 is a reply to message #1862433] Mon, 05 February 2024 14:01 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
With Scout 24.1 (only beta now, will be released in March 2024), the Scout application will not provide a .war anymore but instead use an embedded Jetty directly. One way of running a 24.1 Scout application in a productive environment is described in this tutorial.

Running a 23.2 Scout application in a similar way locally should be possible, you might get some more inspiration by having a look at the ui.html.app.zip module as generate by the updated Scout Archetype for 24.1. Be aware that there were several changes between 23.2 and 24.1 regarding the former dev Jetty server (migration guide).

Either use your IDE and the wizard to create a new Scout Classic project with version 24.1.0-beta.1 or use the command:

mvn archetype:generate -B -DarchetypeGroupId=org.eclipse.scout.archetypes -DarchetypeArtifactId=scout-helloworld-app -DarchetypeVersion=24.1.0-beta.1 -DgroupId=org.example.lorem  -DartifactId=org.example.lorem -Dversion=1.0-SNAPSHOT -Dpackage=org.example.lorem -DdisplayName=Lorem -DjavaVersion=11 -DsimpleArtifactName=lorem
Re: Easiest way to run the UI on computer [message #1863507 is a reply to message #1863489] Tue, 06 February 2024 23:40 Go to previous messageGo to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Hello Stephan, thank you very much, I have done some experiments and it is exactly what I was looking for.
I will slowly migrate my apps and wait for March.

What I don't understand is why I cannot change the front port, even if I play with the value of scout.app.port=8443, it goes at https://mydomain:8082. but not 8443... I am using a signed certificate and had no trouble with tomcat (it was correctly running at HTTPS/8443). I don't understand from where the 8082 comes from.


edit : ok I just noticed It comes from the starting script ... lol. It overrides the config.properties!
set JVM_ARGS=-Xms64m -Xmx512m -XX:-OmitStackTraceInFastThrow -Dscout.app.port=8082

Amazing work on the framework.

[Updated on: Tue, 06 February 2024 23:44]

Report message to a moderator

Re: Easiest way to run the UI on computer [message #1863508 is a reply to message #1863507] Wed, 07 February 2024 01:46 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Thanks for your feedback, glad to hear.

And sorry for the confusion regarding the HTTP port, I've improved the tutorial regarding the override in the shell scripts, see this commit.
Re: Easiest way to run the UI on computer [message #1863551 is a reply to message #1863508] Thu, 08 February 2024 23:45 Go to previous messageGo to next message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Thank you for the update. I have successfully completed the migration of an application, overcoming some initial challenges with the transition from javax to jakarta namespaces using hibernate, as well as resolving issues related to dependencies convergence. The command mvn clean verify executes without any issues, and everything appears to be functioning correctly at this stage. that is very great!

However, when I attempt to perform an 'update maven' operation on my projects, I encounter an infinite loop. Despite attempting to reimport my project into a new workspace, the problem reoccurs after a few builds. While this issue is not critical, I know it is a beta but thought it was important to bring it to your attention.

Additionally, I am experiencing some confusion regarding the Maven configuration. I encountered issues with duplicate classes and found it necessary to explicitly include the following duplicate-finder-maven-plugin configuration in each project's pom.xml file:
<plugin>
    <groupId>org.basepom.maven</groupId>
    <artifactId>duplicate-finder-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>none</phase>
        </execution>
    </executions>
</plugin>

In previous versions, it was sufficient to specify this plugin only in the parent pom.xml. This change in requirement has added to the complexity of managing the project configuration.

And finally, when I use Ctrl+Space to create a column or a field, it doesn't seem to work. It is reproductible in the helloworld project.

I am currently using Eclipse 2023-12 with the 23.1 beta version.

[Updated on: Fri, 09 February 2024 01:12]

Report message to a moderator

Re: Easiest way to run the UI on computer [message #1863554 is a reply to message #1863551] Fri, 09 February 2024 08:00 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 55
Registered: August 2015
Location: Munich
Member
As far as I understand, it should still be possible to specify the plugin settings once in the parent pom.xml.

However I am curious why it is necessary to disable the duplicate-finder; would it not be possible to exclude specific duplicate dependencies from the dependencies providing the duplicate classes? What classes are duplicated if the plugin is not disabled?
Re: Easiest way to run the UI on computer [message #1863557 is a reply to message #1863554] Fri, 09 February 2024 10:11 Go to previous messageGo to next message
Fritz Schinkel is currently offline Fritz SchinkelFriend
Messages: 7
Registered: January 2022
Junior Member
Hi,

you have migrated your applications to 24.1 and with this you have transitioned from javax to jakarta, is that correct?
The Eclipse Scout SDK bundled in Eclipse 2023-12 (SDK-version 13.0.27) does not support the new jakarta-dependencies, but the one bundled in the March release will (SDK-version 13.0.28).
How you can install a new SDK version is explained here. Just use the update site http://download.eclipse.org/releases/2024-03.
I tested with a new 24.1-Helloscout-project and this solved the infinite maven-update and the Ctrl+Space problems for me. For Ctrl+Space I noticed that it only works if you haven't typed anything yet. I don't know if thats how its supposed to work, but I will look into it.

Kind regards,
Fritz
Re: Easiest way to run the UI on computer [message #1863580 is a reply to message #1863557] Mon, 12 February 2024 21:56 Go to previous message
Pr Nico is currently offline Pr NicoFriend
Messages: 15
Registered: February 2021
Junior Member
Hello,
You're right, it's my fault. I was using the wrong Eclipse (2023-12 instead of the future 2024-03), It solves the autocomplete issue (well present in 2023-12 though, what ever the version of scout I pick). Also, yes, I migrated from javax to jakarta.

Regarding the duplicate dependencies, it's after adding Hibernate, which seems to create a lot of duplicates. I haven't had the time to thoroughly analyze all of this yet, I reused the dependencies from my 22.x project where I know everything works to save time. For now I simply duplicated my disabling of the duplicate-finder in each pom.
Previous Topic:please help me figure out this error
Next Topic:Error when deploying an application to Tomcat on Windows
Goto Forum:
  


Current Time: Thu May 09 02:26:57 GMT 2024

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

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

Back to the top