ocpsoft / rewrite

OCPsoft URL-Rewriting Framework
http://ocpsoft.org/rewrite/
Apache License 2.0
187 stars 86 forks source link

Can't get PrettyFaces running with Quarkus & Primefaces #296

Open dmarko484 opened 3 years ago

dmarko484 commented 3 years ago

I'm experimenting with Quarkus + Myfaces/Primefaces based on this repo https://github.com/apache/myfaces/tree/master/extensions/quarkus/showcase.

Here I'm trying to include Prettyfaces to get nicer URLs. More specifically I'm trying to use Rewrite by following this guide https://github.com/ocpsoft/rewrite/blob/master/documentation/src/main/asciidoc/configuration/annotations/index.asciidoc by using annotation.

Seems to me that, when using annotations, I just need to add dependency into pom and annotate a page like this: @Join(path="/welcome", to="/demo/index.xhtml") . I did both, can see

"RewritePhaseListener starting up" in console but URL /welcome is not working. Do you have any working example of Rewrite together with Quarkus?

melloware commented 3 years ago

I would also like to see this updated for Quarkus

lincolnthree commented 2 years ago

Hey folks. Apologies for the very late reply on this (was dealing with some family stuff.) If you can provide a sample app with Quarkus and Rewrite, I'd be happy to take a look at what's going on here. I have never used Quarkus so I can't say what might be going wrong without a reproduction/sample.

melloware commented 2 years ago

I have this fully runnable application using Quarkus and PrimeFaces etc.

https://github.com/melloware/quarkus-faces

It should be easy to modify it to use Rewrite and see what is wrong.

poikilotherm commented 1 year ago

@melloware @dmarko484 there has been a new alpha release for usage with EE9 and EE10. Could you test things again with those?

I also saw that Prettyfaces makes heavy usage of CDI at runtime in lots of the Arquillian tests, so maybe using Quarkus deployment model of injection at compile time is problematic here? Is it possible to run the Arquillian tests on Quarkus as a target container? That might help with getting things going.

melloware commented 1 year ago

I will say Quarkus is very particular and there are some things not even allowed like CDI Extensions etc. So there is a good possibility that Rewrite needs to change for Quarkus.

lincolnthree commented 1 year ago

Hey @melloware - Thanks, yes, It would be great if you could modify that project, and post steps here so that we can reproduce the issue. If you could please also provide stack traces or other errors you receive, that would be very helpful. It's hard to diagnose an issue without this.

Thanks!

lincolnthree commented 1 year ago

I would also recommend trying to use Rewrite Servlet directly instead of Rewrite Config PrettyFaces. If that works, which is my guess, it would still be nice to know what errors PrettyFaces is causing.

rafaelstelles commented 7 months ago

Hi @lincolnthree ,

I clone this project , and added the rewrite branch with dependencies, but not working. Below, the stacktrace.

I run quarkus with command mvn quarkus:dev, according documentation. [Link the project](https://github.com/rafaelstelles/quarkus-faces/tree/rewrite)

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        ... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
        ... 15 more
Caused by: java.lang.RuntimeException: org.ocpsoft.rewrite.cdi.manager.BeanManagerUnavailableException: Failed to locate BeanManager using any of these providers: org.ocpsoft.rewrite.cdi.manager.DefaultJndiBeanManagerProvider(10), org.ocpsoft.rewrite.cdi.manager.ServletContainerJndiBeanManagerProvider(11)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:556)
        at io.quarkus.deployment.steps.UndertowBuildStep$build767851419.deploy_3(Unknown Source)
        at io.quarkus.deployment.steps.UndertowBuildStep$build767851419.deploy(Unknown Source)
        ... 16 more
Caused by: org.ocpsoft.rewrite.cdi.manager.BeanManagerUnavailableException: Failed to locate BeanManager using any of these providers: org.ocpsoft.rewrite.cdi.manager.DefaultJndiBeanManagerProvider(10), org.ocpsoft.rewrite.cdi.manager.ServletContainerJndiBeanManagerProvider(11)
        at org.ocpsoft.rewrite.cdi.manager.BeanManagerLocator.getBeanManager(BeanManagerLocator.java:85)
        at org.ocpsoft.rewrite.cdi.manager.BeanManagerAware.getBeanManager(BeanManagerAware.java:52)
        at org.ocpsoft.rewrite.cdi.CdiServiceEnricher.produce(CdiServiceEnricher.java:46)
        at org.ocpsoft.common.services.ServiceLoader.loadEnriched(ServiceLoader.java:269)
        at org.ocpsoft.common.services.ServiceLoader.loadClass(ServiceLoader.java:220)
        at org.ocpsoft.common.services.ServiceLoader.loadService(ServiceLoader.java:209)
        at org.ocpsoft.common.services.ServiceLoader.loadServiceFile(ServiceLoader.java:187)
        at org.ocpsoft.common.services.ServiceLoader.reload(ServiceLoader.java:146)
        at org.ocpsoft.common.services.ServiceLoader.iterator(ServiceLoader.java:341)
        at org.ocpsoft.common.util.Iterators.asList(Iterators.java:40)
        at org.ocpsoft.rewrite.servlet.RewriteFilter.init(RewriteFilter.java:87)
        at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:112)
        at io.undertow.servlet.core.ManagedFilter.createFilter(ManagedFilter.java:80)
        at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:591)
        at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:556)
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:604)
        at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:598)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:546)
        ... 18 more
rafaelstelles commented 6 months ago

Hi @lincolnthree , any news about this ?

teacurran commented 3 weeks ago

I ended up here because I was having trouble with Annotations.

It seems like it's trying to scan /WEB-INF/classes/ but quarkus apps are packaged with just /classes/.

I was able to get it working fine with pretty-config.xml if I put it in a directory called /resources/META-INF/resources/WEB-INF