Вопрос

I have this code in a .xhtml file:

<h:inputText id="userName" value="#{userEntity.userName}"
             title="${bundle['signup.createuser.username']}"
             maxlength="#{jsfConst.userNameMaxFieldSize}">
</h:inputText>

But the maxlength property is never set when deploying the war file in Embedded Glassfish 4.0. I deploy the very same war file to Glassfish 4.0 installation and it works fine.

I a using this Glassfish dependency in my POM:

<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>4.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.jboss.arquillian.container</groupId>
    <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
    <version>1.0.0.CR3</version>
    <scope>test</scope>
</dependency>

And this is the jsfConst.java file:

@ManagedBean
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class JsfConst {
    public int getEmailFieldSize() {
        return Const.emailFieldSize;
    }

    public int getUserNameMaxFieldSize() {
        return Const.userNameMaxFieldSize;
    }
}

My question is, what am I missing with Embedded Glassfish that makes it fail to enable the EL?

UPDATE:

This is the web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <error-page>
        <exception-type>com.sun.faces.context.FacesFileNotFoundException</exception-type>
        <location>/pagenotfound.jsp</location>
    </error-page>
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/sessionexpired.jsp</location>
    </error-page>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
</web-app>
Это было полезно?

Решение

In Arquillian, you need to declare all classes that comprise the WAR file to deploy and test. Just register JsfConst in the WAR using ShrinkWrap.create(WebArchive.class, "createUser.war").addClass(JsfConst.class)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top