Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PiT 23.1: servlet container does not listen to 8181 #100

Closed
manolo opened this issue May 23, 2022 · 14 comments
Closed

PiT 23.1: servlet container does not listen to 8181 #100

manolo opened this issue May 23, 2022 · 14 comments
Assignees
Labels
bug Something isn't working severity: major

Comments

@manolo
Copy link
Member

manolo commented May 23, 2022

After #99 sever does not listen to any port, but artifact seems deployed

[INFO] Building jar: /private/tmp/kk/vaadin-flow-karaf-example/main-ui/target/main-ui-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- karaf-maven-plugin:4.4.0:run (run) @ main-ui ---
[INFO] Extracting Karaf container
[INFO] Starting Karaf container
May 23, 2022 10:07:47 AM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
May 23, 2022 10:07:47 AM org.apache.karaf.main.Main launch
INFO: All initial bundles installed and set to start
May 23, 2022 10:07:47 AM org.apache.karaf.main.Main$KarafLockCallback lockAcquired
INFO: Lock acquired. Setting startlevel to 100
May 23, 2022 10:07:47 AM org.apache.karaf.main.ShutdownSocketThread run
INFO: Shutdown socket thread is listening on 127.0.0.1:65327
[INFO] Deploying features repository /private/tmp/kk/vaadin-flow-karaf-example/main-ui/target/feature/feature.xml
[INFO] Artifact deployed

How to reproduce

  • git clone https://github.com/vaadin/vaadin-flow-karaf-example.git
  • cd vaadin-flow-karaf-example
  • mvn clean install
  • mvn -B -pl main-ui install -Prun
  • Server never listen to 8181
@manolo manolo mentioned this issue May 23, 2022
9 tasks
@manolo manolo changed the title PiT: servlet container does not listen to 8081 PiT 23.1: servlet container does not listen to 8081 May 23, 2022
@mcollovati
Copy link
Contributor

Shouldn't port be 8181?

@mshabarov
Copy link

mshabarov commented May 23, 2022

Yes, it should be 8181. I got the following when navigate to localhost:8181

HTTP ERROR 404 Not Found
URI: /
STATUS: 404
MESSAGE: Not Found
SERVLET: org.apache.felix.http.base.internal.dispatch.DispatcherServlet-284a30a7

@mcollovati
Copy link
Contributor

mcollovati commented May 23, 2022

It seems to work, after waiting for a while. Or refreshing the page several times.
But not always

@mcollovati
Copy link
Contributor

mcollovati commented May 23, 2022

@mshabarov can you please try if the following configuration in main-ui/pom.xml works for you?

<featuresToInstall>pax-web-http-whiteboard,scr,spifly,${project.artifactId}</featuresToInstall>

Edit: websocket support does not work with this configuration

@mshabarov
Copy link

With the change you mentioned above, I got:
There was an exception while trying to navigate to '' with the root cause 'java.lang.ClassNotFoundException: com.vaadin.flow.component.HasClearButton not found by com.vaadin.flow.server [145]' - the same as in vaadin/base-starter-flow-osgi#224 , so I guess 404 is solved by switching to the PAX Web.

We should't sacrifice of web socket support in my opinion. Do you have any ideas why felix-http, war features has been broken suddenly @mcollovati ?

@mcollovati
Copy link
Contributor

As mentioned here with felix-http and the war feature togheter there are port conflicts.
Previously http was used in place of felix-http, but this configuration did not work with Java 17, if I recall correctly.

@taefi
Copy link
Contributor

taefi commented May 24, 2022

I tried this out both with Java 11 and Java 17, with karaf-maven-plugin:4.4.0 and karaf-maven-plugin:4.3.7 (which supports Java 17 as well with overriding the version of org.apache.felix.framework to 7.0.3) and could spot the following behaviour pattern:

When the whole application is built from scratch (mvn clean install) and main-ui is run (via mvn -pl main-ui install -Prun), at some point during the process, it downloads and run the karaf runtime inside the main-ui/target/karaf directory. Then it runs the following commands:

feature:install http war
feature:repo-add mvn:com.example/main-ui/1.0.0-SNAPSHOT/xml/features 

which results in creating a local cache from the 192 deployed and installed bundles under ./main-ui/target/karaf/data/cache directory. This is obviously a time consuming task for the first time, and I was getting the same 404 error screen (mentioned by @mshabarov) while this was is going on. After this completes, you can refresh the page and see the application is running on http://localhost:8181.

From now on, if you stop and just rerun the application without performing a clean install this time, the application would be available exactly after you see the [INFO] Artifact deployed message in the terminal, which completely makes sense to me.

I must admit that sometimes (once or twice in 10 times), after a build from scratch (caches cleared out), the karaf running process was not completing as it should, and it seems to be stuck at some point during that cache building process, since I could monitor the number of cache folders doesn't reach to 192 (with the current referenced bundles and dependencies) and it is not proceeding further no matter how much time you give it. At this point, re-running the project (without clean) would simply continue building the rest of the cache and results into a successfully running application. Rarely, I could also observe 404 error message even without a clean install, which obviously could be alleviated via a re-run as well.

I couldn't find any relationship between any possible anomaly of Vaadin platform and this behaviour so far. Also, could not spot any difference between the behaviour of 4.4.0 and 4.3.7 versions of karaf-maven-plugin.

@manolo manolo changed the title PiT 23.1: servlet container does not listen to 8081 PiT 23.1: servlet container does not listen to 8181 Jun 2, 2022
@manolo
Copy link
Member Author

manolo commented Jun 2, 2022

Tried this again, and now I get this osgi error:

Can't start container: Failed to add features to karaf: InvocationTargetException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=main-ui; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=main-ui)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve main-ui/1.0.0.SNAPSHOT: missing requirement [main-ui/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=com.vaadin.flow.osgi; type=osgi.bundle; version="[8.0.2,8.0.2]"; resolution:=mandatory [caused by: Unable to resolve com.vaadin.flow.osgi/8.0.2: missing requirement [com.vaadin.flow.osgi/8.0.2] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.vaadin.pro.licensechecker)(version>=1.4.0)(!(version>=2.0.0)))"]]

@mshabarov
Copy link

Tried with fresh starter using branch v23 and both java 11 and 17:

git clone https://github.com/vaadin/vaadin-flow-karaf-example.git
cd vaadin-flow-karaf-example
change vaadin verison to <vaadin.version>23.1.0.rc1</vaadin.version>
mvn clean install
mvn -B -pl main-ui install -Prun
localhost:8181.

Works fine on my mac.
Did not tried with 23.0 however yet.

@mshabarov
Copy link

It doesn't work with 23.0.10 indeed.
23.0 is not compatible with the 8.0.2 because of license-checker.
with

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-osgi</artifactId>
            <version>8.0.1</version>
        </dependency>

it works

mshabarov added a commit to vaadin/platform that referenced this issue Jun 2, 2022
Flow OSGi 8.0.2 is not compatible with 23.0 because of License Checker 1.4.1.

Fixes vaadin/vaadin-flow-karaf-example#100
ZheSun88 pushed a commit to vaadin/platform that referenced this issue Jun 2, 2022
Flow OSGi 8.0.2 is not compatible with 23.0 because of License Checker 1.4.1.

Fixes vaadin/vaadin-flow-karaf-example#100
@mshabarov
Copy link

Tested with platform 23.0.11 and it works.

@mcollovati
Copy link
Contributor

Karaf feature list in main-ui seems to be incorrect and causes bind exceptions on port 8181, because of multiple services trying to listen on it

Following configuration seems to work

http-whiteboard,scr,spifly,${project.artifactId}

@mcollovati mcollovati added bug Something isn't working severity: major labels Aug 12, 2022
@mcollovati mcollovati moved this from Needs triage to New P2 in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Aug 12, 2022
@mcollovati
Copy link
Contributor

See #114

@taefi taefi self-assigned this Aug 16, 2022
taefi added a commit that referenced this issue Aug 25, 2022
…E.md

After some investigation still issue #100 is hanging,
so the README.md file is updated to mention it as a
limitation.
mshabarov pushed a commit that referenced this issue Aug 30, 2022
…E.md (#117)

After some investigation still, issue #100 is hanging,
so the README.md file is updated to mention it as a
known issue which might not be related directly to the
Vaadin OSGi addon.
@manolo
Copy link
Member Author

manolo commented Oct 4, 2022

Is this still an issue? apparently it listens to 8181, although the project still does not work see: #124

@manolo manolo closed this as completed Oct 11, 2022
OLD Vaadin Flow bugs & maintenance (Vaadin 10+) automation moved this from New P2 to Closed Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity: major
Development

No branches or pull requests

4 participants