No registered org.ocpsoft.rewrite.el.spi.ExpressionLanguageProvider could handle

Splash Forums Rewrite Users No registered org.ocpsoft.rewrite.el.spi.ExpressionLanguageProvider could handle

This topic contains 8 replies, has 3 voices, and was last updated by  Christian Kaltepoth 2 years, 11 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #24493

    antonu17
    Participant

    Hello!
    I’m using tomcat-6.0.36, mojarra-2.1.24, rewrite-servlet-2.0.5.Final, rewrite-integration-cdi-2.0.5.Final, weld-servlet-1.0.1-Final
    Bean code:

    @Named
    @RequestScoped
    @Join(path = "/test/{name}", to = "/test.faces")
    
    public class TestBean {
    
        @Parameter("name")
        private String name;
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }

    Page code:

    <!DOCTYPE html
            PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html">
    
    <h:head>
        <title>Simple JSF Facelets page</title>
    </h:head>
    
    <h:body>
        <h:form>
            <h:outputText value="Hello #{testBean.name}"/>
        </h:form>
    </h:body>
    
    </html>

    When i open http://localhost:8080/test/kit, i see:
    exception

    javax.servlet.ServletException: Error during Rewrite processing. Please inspect stack trace for root cause.
    org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:193)

    root cause

    org.ocpsoft.rewrite.exception.RewriteException: No registered org.ocpsoft.rewrite.el.spi.ExpressionLanguageProvider could handle the Expression [testBean.name]
    	org.ocpsoft.rewrite.el.El.executeProviderCallable(El.java:162)
    	org.ocpsoft.rewrite.el.El.access$100(El.java:40)
    	org.ocpsoft.rewrite.el.El$ElProperty.submit(El.java:280)
    	org.ocpsoft.rewrite.util.ParameterUtils$BindingOperation.perform(ParameterUtils.java:160)
    	org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.rewriteHttp(DefaultHttpRewriteProvider.java:174)
    	org.ocpsoft.rewrite.servlet.http.HttpRewriteProvider.rewrite(HttpRewriteProvider.java:43)
    	org.ocpsoft.rewrite.servlet.RewriteFilter.rewrite(RewriteFilter.java:241)
    	org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:187)
    

    and in tomcat.log:

    Caused by: java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
    	at org.ocpsoft.rewrite.cdi.expressions.ExpressionFactoryProducer.createExpressionFactory(ExpressionFactoryProducer.java:36)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
    	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
    	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
    	at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
    	at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:200)
    	at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:164)
    	... 30 more

    Is it because of tomcat-6’s EL implementation? Could this be working on tomcat-6?

    #24494

    antonu17
    Participant

    With tomcat-7 everything is working.
    But with @RequestScoped bean is creating twice, first when Rewrite sets parameter, second when field requested from page. So everytime we see empty string on the page. When i changed @RequestScoped to @ConversationScoped, it started to work as expected. I cannt understand difference between request and conversation scope.

    #24520

    Hi there Antonu,

    Sorry for the late reply. I’ve been on vacation and we had a problem with our forum’s notification emails recently.

    To begin to attempt to answer this question, I believe you are correct that Tomcat 6 probably bundles a version of the ExpressionFactory that is incompatible with Rewrite. We reference the EL2.2 specification API in our integration-cdi module, so if Tomcat 6 does not supply that API, this could cause problems. This class is responsible for creating the provider.

    package org.ocpsoft.rewrite.cdi.expressions;
    
    import javax.el.ExpressionFactory;
    import javax.enterprise.context.ApplicationScoped;
    import javax.enterprise.inject.Produces;
    import javax.enterprise.inject.spi.BeanManager;
    
    /**
     * Responsible for producing the {@link ExpressionFactory}
     *
     * @author Stuart Douglas
     * @author Pete Muir
     */
    class ExpressionFactoryProducer {
    
        @Produces
        @Composite
        @ApplicationScoped
        ExpressionFactory createExpressionFactory(BeanManager beanManager) {
            return beanManager.wrapExpressionFactory(ExpressionFactory.newInstance());
        }
    
    }

    I believe that CDI actually requires this version of the API to use some features of EL, but I could be wrong. What happens if you try to include an EL implementation of your own? I believe this S.O. question provides a solution – http://stackoverflow.com/questions/2333605/using-el-2-2-with-tomcat-6-0-24

    I hope this helps!
    ~Lincoln

    #24570

    antonu17
    Participant

    Hello Lincoln Baxter III!
    Thank you for response. This is really beacuse of EL-2.1 in Tomcat-6. With EL-2.2 its working.
    Can you help me understand why @RequestScoped named bean is instantiating twice, and paramenter data is loosing?

    UPD. I think this should be another topic, my bad.

    • This reply was modified 2 years, 12 months ago by  antonu17. Reason: update
    #24611

    Are you using the JSF request scope or the CDI request scope annotation?

    #24671

    antonu17
    Participant

    I’m using CDI request scope annotation

    #24673

    How do you know that your bean is created twice? Do you have a log statement in your constructor? If so, don’t do that. CDI creates proxy classes for request scoped beans. These proxies are created by subclassing your bean. When an instance of this proxy is created, your constructor will also be executed. That’s why you see constructor calls twice. One for the proxy, one for the real bean. You typically shouldn’t use constructors for your managed bean. Instead, use @PostConstruct for initialization.

    #24677

    antonu17
    Participant

    I’m using intellij idea dbugger. I just set breakpoint in getName() and setName() of TestBean class. Setter is invoking and sets name string, but when getter is invoking – name contains null, and address of TestBean instance in debuuger is different from address of when it was in setter.

    ps.
    i’ve made a another one test with debbuger while writing this reply, and now it working as axpected. the same TestBean instance in both getter and setter invokings. i don’t know why is wasn;t so before. anyway, question is closed, sorry for bothering you.

    #24678

    Nice to hear you solved your problem. 🙂

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

Comments are closed.