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

Bootsfaces renderers not being called #732

Closed
jimmc929 opened this issue Apr 25, 2017 · 28 comments
Closed

Bootsfaces renderers not being called #732

jimmc929 opened this issue Apr 25, 2017 · 28 comments

Comments

@jimmc929
Copy link

jimmc929 commented Apr 25, 2017

This is a follow-up to issue #636 submitted by tg47. Unfortunately, this issue continues to plague us. I work with Tom and I have a separate Bootsfaces project completely independent of his that behaves the same way. We are using Payara 4.1.1.171 (build 137). I am using Bootsfaces 1.0.2. I am working on a completely separate set of workstations than Tom (different machine, different O/S, etc.) and am seeing the same behavior. Here is what happens:

I deploy an EAR to Payara. In 80% of the cases everything works great. However, in about 20% of the cases, the Bootsfaces components do not render. In this situation, non-Bootsfaces components on the page do render, such as h:outputLabel, h:form, etc.

I can solve this problem in one of the following ways:

  • Undeploy and redeploy the application
  • Undeploy, shut down Payara, remove the OSGI cache, restart Payara, redeploy
  • Undeploy, shut down Payara, remove the OSGI cache, reboot the machine, restart Payara, redeploy

(Note that there are no other applications running in the Payara instance- just the one under test.)

In 100% of the cases, one of these steps will fix the problem. For this reason, I am inclined to rule out issues in the build process. If the same EAR can be made to work by restarting the container, etc., it does not seem all that likely that the problem is in the way the EAR is built. (Tom had also observed differences in how an EAR with Bootsfaces behaves depending on which server it is deployed to. All servers are running the same version of Payara, so again this would seem to point away from build issues.)

I have downloaded the Bootsfaces sources and have been debugging the application. (Our application is quite simple.) Here is what I am seeing:

The AddResourcesListener methods processEvent() and isListenerForSource() methods are being called. The seems to indicate that Faces is aware of the Bootsfaces component library. The processEvent() method successfully calls addCSS(), addJavascript(), and addMetaTags(). There do not seem to be any exceptions thrown in these methods.

I then put breakpoints in the ContainerRenderer (for b:container, which wraps the JSF page) and the encodeBegin() and encodeEnd() methods are never called. I also tried breakpoints in various other renderers, such as b:panel, etc., but none are ever called. It seems that Faces is skipping rendering the Bootsfaces components entirely in the Render Response Phase.

It "feels" to me like some sort of race condition is occurring during deployment. Once the EAR deploys successfully, it runs properly forever. But in (roughly) 20% of the cases, something seems to go wrong in deployment, and from that point on, Faces does not seem to call any of the Bootsfaces renderers during Render Response Phase.

Can you think of any possible cause for this? I am not an expert in the internals of Faces, so I don't know where to put a breakpoint to see where the top-level Faces code should be calling into the Bootsfaces renderers. I can see that the Render Response Phase is proceeding normally, and the non-Bootsfaces components are being rendered. I thought that the AddResourcesListener would probably not be called in this situation, but it is. So Faces seems to know about the existence of Bootsfaces. (I can see that AddResourcesListener is specified as a SystemEventListener in the faces-config.xml file.) I'm more than willing to continue to debug the situation if you can offer any suggestions as to where to look. I've noticed a few other posts alluding to the same problem, so I don't think this is an isolated instance (though it might not be very common). We think Bootsfaces is terrific and would like to continue using it, but this issue makes each deployment a bit of a guessing game. Any advice would be appreciated, thanks!

P.S. I haven't described the application in detail because I don't really think the application code is all that relevant. I have seen this behavior with just a simple JSF page with b:container, etc. There are no other complicated libraries included (e.g., my project does not use Shiro, etc.). I could probably create a simple demo application if needed, but then in ~ 80% of the cases it will work perfectly, so I'm not sure how helpful that would be. The Payara server log shows "Application running on Bootsfaces 1.0.2" and there are no errors or exceptions. In other words, we've tried to look for the obvious stuff first! :)

P.S.S. I notice that Bootsfaces uses a variety of external resources. I am not sure if these resources are retrieved asynchronously, but is it possible that if one of these resources is not retrieved quickly enough, that Bootsfaces gets "stuck" in some way and is unable to render components? Whatever is happening, the actual component renderers are not being called during the Render Response. Just a thought...

@stephanrauh
Copy link
Collaborator

Awesome analysis, thanks!

I suppose Payara uses Mojarra. If so, add a breakpoint to the method ApplicationImpl::newThing(). It's the class creating new JSF components. In the past, I've found a couple of weird configuration bugs by debugging newThing().

Other ideas:

  • add a breakpoint to the constructor of Container ("Is the component created correctly?")
  • If that breakpoint isn't hit: add a class breakpoint to Container ("is the component class loaded at all?")
  • If the component ist loaded correctly, add a breakpoint to ContainerRenderer ("is the component renderer detected correctly?")
  • and just a wild shot: is <b:datePicker /> rendered correctly? It's one of the few components that don't delegate rendering to a dedicated renderer class.

@stephanrauh
Copy link
Collaborator

BTW, you've mentioned that you deploy an EAR. What happens if you deploy a simple WAR file instead?

@jimmc929
Copy link
Author

Stephan- thanks for so many good suggestions so quickly! I will definitely try those breakpoints. At the moment, the EAR is working perfectly (of course!), so I will have to wait until it fails again. As to EAR- Tom's project is a WAR and he is seeing the same behavior, so I don't think it's likely to be a packaging issue.

One other thing I do notice is that when the app is failing, the screen comes back very very fast. Much faster than when it is working correctly. The difference is only a second or two, but it seems like the speed may be because the renderer is skipping things. Just one more piece of the puzzle to mull over... Thanks again!!

@stephanrauh
Copy link
Collaborator

Did you have any progress? BTW, is it possible to switch temporarily to another application server for testing purposes? I'd like to check whether it's a specific Payara problem, or whether it's a general problem.

@jimmc929
Copy link
Author

jimmc929 commented Apr 26, 2017 via email

@jimmc929
Copy link
Author

jimmc929 commented May 1, 2017

Just now having the issue again- will try your debugging ideas!

@jimmc929
Copy link
Author

jimmc929 commented May 1, 2017

I have been able to do some extensive debugging and can see the problem, but I don't understand the cause of it.

To bring you up to date: Today I started Payara which had three simple Bootsfaces apps that had been deployed and were working perfectly yesterday. Today when Payara came up, none of the apps would display any Bootsfaces components. So in other words, without rebuilding or even redeploying any of the apps, they suddenly failed to display the Bootsfaces components. (All three apps, which are not directly related to each other.) Rebuilding or redeploying any of the apps did not help.

From debugging per your suggestions, I can see that the Bootsfaces component constructors are being called correctly, and ApplicationImpl::newThing seemed to be finding them just fine. However, as before, none of the renderers were being called.

In debugging the Faces RenderResponsePhase class, I could see that all of the non-Bootsfaces components were being rendered correctly. Within UIComponentBase.encodeBegin(), the code is trying to render a particular component- in this case a net.bootsfaces component. It asks to get the RenderKit for the current context. The RenderKit it selects is HTML_BASIC. (Is this what you would expect?) When it queries this RenderKit for the component renderer by Family (net.bootsfaces) and rendererType (navBar in this case), the "net.bootsfaces" renderers are not present in the list of families, so no renderer is found. I took a screen shot of the renderers that were listed and I will try to attach it here. (You will see the org.primefaces family listed- by now the project has added the Signature component from PF, but keep in mind that this problem can be observed on any project with or without other component libraries.)

The question is: Why is the net.bootsfaces component family missing from the list for the RenderKit? Obviously without this registration, none of the components will render. Is HTML_BASIC the render kit you would expect to be used? It would seem that there may be a problem with how Bootsfaces registers its renderer "family" with the context, and this problem seems to survive multiple undeploy/deploy actions. (I haven't yet tried restarting Payara because I wanted to capture the problem and really probe it before it disappeared.)

It looking at various other classes during the debugging, it does seem that the system knows about Bootsfaces. It is just the renderer family registration that is missing.

Which part of the code is responsible for registering the renderer family with the context? If you want I can debug it some more, placing breakpoints there, etc. Let me know, thanks!

@jimmc929
Copy link
Author

jimmc929 commented May 1, 2017

rendererfamilies

@stephanrauh
Copy link
Collaborator

I'm puzzled. We're using annotations to define the renderers. From a technical perspective, we could define a default renderer, ignoring the standard detection mechanism. But that's only the last resort.

This is the definition of the renderer:

@FacesRenderer(componentFamily = "net.bootsfaces.component", rendererType = "net.bootsfaces.component.badge.Badge")
public class BadgeRenderer extends CoreInputRenderer {

and this is how the component links to it:

@FacesComponent(Badge.COMPONENT_TYPE)
public class Badge extends BadgeCore implements net.bootsfaces.render.IHasTooltip, net.bootsfaces.render.IResponsive {


	public static final String COMPONENT_TYPE = C.BSFCOMPONENT + ".badge.Badge";

	public static final String COMPONENT_FAMILY = C.BSFCOMPONENT;
	public static final String DEFAULT_RENDERER = "net.bootsfaces.component.badge.Badge";

	public Badge() {
		AddResourcesListener.addThemedCSSResource("core.css");
		//!bs-less//AddResourcesListener.addThemedCSSResource("badges.css");
		setRendererType(DEFAULT_RENDERER);
	}

	public String getFamily() {
		return COMPONENT_FAMILY;
	}

In theory, we can also do without the DEFAULT_RENDERER. Do you have the source code version of BootsFaces at hand? If so, can you check what happens if you remove the line setting the default renderer in the constructor?

@jimmc929
Copy link
Author

jimmc929 commented May 2, 2017

Hi Stephan,
Do you know when the code that is behind the @FacesRenderer annotation is supposed to run? Is it when the class library is first loaded, or when it is first accessed by any app, or every time it is accessed by an app, or ?? I am just not that familiar with the innards of JSF. Unfortunately I had to restart the server and redeploy the apps (for another reason) and now they are working fine, so it may be a while before they break again. I just have the source JAR for Bootsfaces for debugging- unfortunately, I'm not able to modify the code as I'm just running from the release JAR. But I'm happy to keep digging if it is helpful. Off the top of my head I can think of two possibilities, though I'm sure there are more: 1) the code behind the @FacesRenderer notation tries to run but some exception is thrown and the container aborts the registration; perhaps there is a sequencing problem... 2) Bootsfaces registers correctly with the "context" (not exactly sure what that is), but then a new context is created and it does not "re-register." (I admit #2 is a total guess!) I do see that Primefaces and Omnifaces are listed in the family registrations, so I wonder if they are doing the registration differently? (i.e., perhaps not with the annotation?) Sorry for these being such shots in the dark!! Let me know what you think, thanks...
Jim

@stephanrauh
Copy link
Collaborator

The class you're looking for is RenderKitConfig. Browse for processAnnotations(FacesRenderer.class). This method asks ConfigManager.getAnnotatedClasses(FacesContext ctx) to return the list of annotated classes.

@jimmc929
Copy link
Author

jimmc929 commented May 2, 2017

When does that code get run?

@stephanrauh
Copy link
Collaborator

stephanrauh commented May 2, 2017 via email

@jimmc929
Copy link
Author

jimmc929 commented Aug 8, 2017

Hi Stephan,
I believe we have developed code to fix this problem. We are currently testing but the initial tests look good. Basically what we saw when looking at the source code and debugging output and comparing to Primefaces, etc., was that the other frameworks did not rely on the @FacesRenderer() annotation, but instead called the RenderKit.addRenderer() methods explicitly for each component. I don't know whether they did this deliberately but apparently the @FacesRenderer() annotation is not reliable, at least not in Glassfish and/or Payara. (We are running Payara, latest build.) So we developed an InitBootsfacesBean CDI bean that was run at the start of each application, and in this bean we explicitly call the addRenderer method for the context's default rendering kit for each Bootsfaces component (as listed in the ComponentsEnum class). It took a bit of fudging because there are some errors in the info listed in ComponentsEnum, but we worked around that. It's not clear whether this bean needs to run at every invocation of the application, but if it does, it does not seem to do any harm. The crucial method is appended below. We'll post the full bean plus more info in a day or so after we do some more testing. Will keep you posted...

Jim

    /**
     * Register the Bootsfaces renderers
     */
    private void initializeBootsfacesRenderers() {
        
        // Loop through all of the Bootsfaces components
        for (ComponentsEnum value : ComponentsEnum.values()) {
            
            // Get the component class information
            String className;
            
            // switchComponent has wrong classpath in ComponentsEnum
            if (value.name().equals("switchComponent")) {
                // Use correct qualified name
                className = "net.bootsfaces.component.switchComponent.Switch";
            } else {
                // Otherwise, use specified value
                className = value.classname();
            }
            
            // See if this is an internal reference
            if (className.contains("Internal")) {
                LOGGER.log(Level.INFO, "Init Bootsfaces: Skipping internal component: " + className);
            } else {
                
                LOGGER.log(Level.INFO, "Init Bootsfaces: Processing component: " + className);
                
                try {
                    
                    // See if we can instantiate the class
                    Class componentClass = Class.forName(className);
                    Class<UIComponentBase> baseClass = componentClass.asSubclass(UIComponentBase.class);
                    UIComponentBase component = baseClass.newInstance();
                    String rendererFamily = component.getFamily();
                    String rendererType = component.getRendererType();

                    // Determine the renderer class name
                    String simpleName = componentClass.getSimpleName();
                    String rendererClassName;
                    switch (simpleName) {
                        case "NavCommandLink":
                            // Shares same renderer with NavLink
                            rendererClassName = "net.bootsfaces.component.navLink.NavLinkRenderer";
                            break;
                        default:
                            // We have to guess at the name of the renderer
                            rendererClassName = className + "Renderer";
                            
                    }
                    
                    // Look up the renderer
                    Class rendererSuperclass = Class.forName(rendererClassName);
                    Class<Renderer> rendererClass = rendererSuperclass.asSubclass(Renderer.class);
                    Renderer renderer = rendererClass.newInstance();
                    LOGGER.log(Level.INFO, "Init Bootsfaces: Registering renderer: " + rendererFamily + "/" + rendererType);

                    // ****** THIS IS THE IMPORTANT CALL TO REGISTER THE RENDERER *********
                    addRenderer(rendererFamily, rendererType, renderer);
                    
                } catch (Throwable e) {
                    LOGGER.log(Level.WARNING, "Init Bootsfaces: Unable to register renderer for component: " + className, e);
                }
                
            }

        }
        
    }

public void addRenderer(String family, String rendererType, Renderer renderer) {
        getDefaultRenderKit().addRenderer(family, rendererType, renderer);
    }

@stephanrauh
Copy link
Collaborator

@BalusC @tandraschko @cagataycivici Some of the users of BootsFaces have observed a very strange phenomenon. According to the analysis of @jimmc929 (see the ticket history above), some application servers don't recognize the JSF annotations reliably. In particular, @FacesRenderer seems to be flaky on Glassfish and Payara. Most of the time it works, but not always.

Have you seen this problem before?

@tandraschko
Copy link

tandraschko commented Aug 8, 2017

Known problem - mostly in older versions. Therefore we still stick with xml config :/

But NOTE: in PF we still support JSF 2.0
As BootsFaces depends on newer versions only, it's just something the payara/glassfish team should look at.

@stephanrauh
Copy link
Collaborator

Thanks for your quick reply! I agree with you, this should be fixed if Glassfish wants to be the reference implementation of JSF. But you know the old saying: If the mountain won't come to Muhammad, Muhammad must go to the mountain.

@gaidai
Copy link

gaidai commented Nov 18, 2017

Hello friend , I had this problem with GlassFish 4.2.0 , but downloaded new 5.0 and added this parameter to glassfish-web.xml : < parameter-encoding default-charset="UTF-8" >
Put it inside - and Bootsfaces will nice render!!

@ggam
Copy link
Collaborator

ggam commented Nov 18, 2017

@gaidai could you please escape the XML of the parameter? I think it has been automatically removed.

@gaidai
Copy link

gaidai commented Nov 18, 2017

And second param I added to web.xml : < context-param >
< param-name >BootsFaces_USETHEME< /param-name >
< param-value >default< /param-value >
< /context-param >

@nando2301
Copy link

Tengo el mismo problema.
Uso GlassFish 4.1.2, Apache Shiro 1.3.2, Shiro Faces 2.0, BootsFaces 1.2.0, Apache Cayenne 4.0.B2, pero tengo un proyecto con los mismos componentes, al copiar partes del proyecto mi página de login no muestra componentes BootsFaces.

Proyecto Original

Proyecto Original

Copia de Proyecto

Copia de Proyecto

pom.xml de proyecto que no muestra componentes BootsFaces

    <dependencies>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.2.7</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cayenne</groupId>
            <artifactId>cayenne-server</artifactId>
            <version>4.0.B2</version>
        </dependency>
        <dependency>
            <groupId>net.bootsfaces</groupId>
            <artifactId>bootsfaces</artifactId>
            <version>1.2.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-faces</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-core</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-web</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-quartz</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.25</version>
        </dependency>
    </dependencies>

web.xml

<?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">
    <display-name>Reuniones</display-name>
    <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>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <!-- Activates the waitcursor and the double-click protection -->
    <context-param>
        <param-name>net.bootsfaces.blockUI</param-name>
        <param-value>true</param-value>
    </context-param>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <mime-mapping>
        <extension>json</extension>
        <mime-type>application/json</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff2</extension>
        <mime-type>application/x-font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff</extension>
        <mime-type>application/x-font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>eot</extension>
        <mime-type>application/x-font-eot</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>ttf</extension>
        <mime-type>application/x-font-ttf</mime-type>
    </mime-mapping>

    <!-- Apache Shiro Begin -->
    <listener>
        <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
    </listener>
    <filter>
        <filter-name>ShiroFilter</filter-name>
        <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>ShiroFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>
    <!-- Apache Shiro End-->

    <!--Apache Cayenne-->
    <filter>
        <filter-name>cayenne-meetings</filter-name>
        <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>cayenne-meetings</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--Apache Cayenne End-->
</web-app>

glassfish-web.xml por defecto.

shiro.ini

[main]
jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.authenticationQuery = SELECT password from user where username = ?
jdbcRealm.userRolesQuery = select r.rolename from role r, userrole ur, user u where ur.role_idrole = r.idrole and ur.user_idusername = u.idusername and u.username = ?;

ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
ds.serverName = 
ds.port =
ds.user =
ds.password =
ds.databaseName =
jdbcRealm.dataSource= $ds

passwordMatcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
credentialsMatcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
credentialsMatcher.hashAlgorithmName = SHA-256
credentialsMatcher.storedCredentialsHexEncoded = true
credentialsMatcher.hashIterations = 5000

multipleroles = org.nando.meetings.utils.MultipleRolesAuthorizationFilter

;authc = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter
authc.loginUrl = /faces/login.xhtml
authc.successUrl = /faces/index.xhtml
multipleroles.unauthorizedUrl = /faces/unauthorized.xhtml

ssl.enabled = false

# Use default password matcher (SHA-256, 500000 hash iterations)
passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher


# Filter Setup
[urls]
/javax.faces.resource/** = anon
/resources/** = anon
/login.xhtml = authc
/faces/index.xhtml = authc
/logout = logout

/ = authc, multipleroles[admin,moderador,organizador,asistente]
/faces/users/** = authc, multipleroles[admin]

Ejecución Netbeans 8.2 OSX El Capitan

Información:   WebModule[null] ServletContext.log():Cleaning up Shiro Environment
Información:   visiting unvisited references
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Información:   Inicializando Mojarra 2.2.14 ( 20161114-2152 unable to get svn info) para el contexto '/meetings'
Información:   This application is running on BootsFaces1.2.0-
Información:   Monitoring jndi:/server/meetings/WEB-INF/faces-config.xml for modifications
Información:   WebModule[null] ServletContext.log():Initializing Shiro environment
Información:   Starting Shiro environment initialization.
Información:   Shiro environment initialized in 364 ms.
Información:   Loading application [meetings] at [/meetings]
Información:   meetings was successfully deployed in 4,056 milliseconds.
Información:   Loading XML configuration resource from file:/Users/fernando/NetBeansProjects/meetings/target/meetings-1.0/WEB-INF/classes/cayenne-meetings.xml
Información:   Loading XML DataMap resource from file:/Users/fernando/NetBeansProjects/meetings/target/meetings-1.0/WEB-INF/classes/meetings-datamap.map.xml
Información:   loading user name and password.
Información:   Connecting to 'jdbc:mysql://n23mac.local:8889/meetings' as 'muser'
Información:   +++ Connecting: SUCCESS.
Información:   setting DataNode 'meetings-datanode' as default, used by all unlinked DataMaps

@stephanrauh
Copy link
Collaborator

Supongo que es una falla de Glassfish. La llamada "reference implementation" de JavaEE frecuentemente tiene dificultades con anotaciones. ¿Puedes usar un otro servidor de aplicaciones? Si no puedes user un otro servidor en producción, ¿puedes desplegar tu aplicación en un otro servidor como prueba de compatibilidad?

@nando2301
Copy link

nando2301 commented Apr 22, 2018

Use Payara Server 4.1.2.174 #badassfish (build 192) con Java(TM) SE Runtime Environment (build 1.8.0_77-b03) y funciona bien, tienes razón @stephanrauh. Trate de usar Java 7 update 80 como dice aquí GlassFish 4.1.2 Released pero no inicia en OSX El Capitan , así que use Java JDK 1.8. Gracias.

Ahora en Payara

Payara

@TheTimeWalker
Copy link
Contributor

TheTimeWalker commented May 16, 2018

Hello! I have the same issue even with the nightly version of Glassfish 5.0.1. It seems like that this hasn't been fixed yet there. On local deployment, I had to redeploy 2-3 times until it worked. On a remote server, this never worked even with trying different steps.

Thanks to @jimmc929 I was able to use his workaround to make Bootsfaces always be rendered at every deploy. I've changed it up a little to fit my needs as I didn't have a function getDefaultRenderKit(). If anybody needs them here's the extra snippet:

private RenderKit defaultRenderKit = getDefaultRenderKit();

public RenderKit getDefaultRenderKit() {
        RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
        FacesContext facesContext = FacesContext.getCurrentInstance();
        return renderKitFactory.getRenderKit(facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT);
}

public void addRenderer(String family, String rendererType, Renderer renderer) {
        defaultRenderKit.addRenderer(family, rendererType, renderer);
}

@stephanrauh
Copy link
Collaborator

stephanrauh commented May 31, 2018

@jimmc929 @tg47 @TheTimeWalker I've compiled your hints to an article: https://www.beyondjava.net/running-bootsfaces-on-glassfish-or-payara

I don't know your real names, so I used your GitHub account names for the kudos section.

If there's anything to improve, just drop me a message.

@nando2301
Copy link

It says:

Forbidden
You don't have permission to access / on this server.

@stephanrauh
Copy link
Collaborator

@nando2301 Oops, sorry - I've changed the URL pattern on my server. Try again. The correct URL is https://www.beyondjava.net/running-bootsfaces-on-glassfish-or-payara

@smcguire36
Copy link

smcguire36 commented Dec 13, 2018

@stephanrauh I just had to use your blog article to solve this same issue on Payara 5.184 (the latest release as of this writing). However, I noted that your class wrapper you put around the function that was shown above needs a default constructor that calls the private method otherwise the private method never gets called.

Here is the top of my implemented class. I also switched out the JSF @ ManagedBean annotation for the CDI @ Named annotation and used the OMNIFaces @ Eager annotation as well. Lastly, I defined the LOGGER variable within the class which was missing also.

@Named
@Eager
@ApplicationScoped
public class InitBootsfacesBean {

    private static final Logger LOGGER = Logger.getLogger("com.arcadis");
    
    public InitBootsfacesBean() {
        initializeBootsfacesRenderers();
    }
    
    /**
     * Register the Bootsfaces renderers
     */
    private void initializeBootsfacesRenderers() {
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants