0

I need to bundle JSF implementation in my WAR file due to known bug in the original mojarra implementation.

I am not allowed to replace the JSF implementation in the modules, so i am using the useBundledJsf property.

Running Payara Version: Payara Server 4.1.1.164 #badassfish (build 28) This versions should support useBundledJsf properly.

I have added this to my glassfish-web.xml:

  <class-loader delegate="false" />
  <property name="useBundledJsf" value="true" />  

and added the javax.faces dependecy to my pom:

<dependency>
   <groupId>org.glassfish</groupId>
   <artifactId>javax.faces</artifactId>
   <version>2.2.13</version>
</dependency>  

I am getting the following error and all injections are failing.

SEVERE: JSF1051: Service entry 'org.glassfish.faces.integration.GlassFishInjectionProvider' does not extend DiscoverableInjectionProvider. Entry will be ignored.

I have tried to add the weld-integration.jar to my project but it still produces the JSF1051 error following by:

Unable to create a new instance of 'org.jboss.weld.jsf.ConversationAwareViewHandler'

The dependency for the weld-integration i have used:

<dependency>
<groupId>org.glassfish.main.web</groupId>
<artifactId>weld-integration</artifactId>
<version>4.1.2</version>
<exclusions>
    <exclusion>
        <artifactId>*</artifactId>
        <groupId>*</groupId>
    </exclusion>
</exclusions>    

tak3shi
  • 2,305
  • 1
  • 20
  • 33

1 Answers1

0

There is an extra feature to make this easier in Payara Server 171 which was added specifically to make these scenarios work properly.

From the documentation:

It’s possible to configure an extreme isolation level on the class loading delegation for deployed applications. With this extreme isolation behavior, a deployed application can force the server to load only classes from libraries included on Payara Server that belong to whitelisted packages defined on its deployment descriptors.

To configure whitelist packaging you can use the <whitelist-package> element on the glassfish-web.xml (WAR artifacts) or the glassfish-application.xml (EAR artifacts). This element can be included multiple times to whitelist multiple packages. Here is an example of whitelisting both the Google Guava and Jackson packages for a WAR application:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  ...
  <whitelist-package>com.google.guava</whitelist-package>
  <whitelist-package>com.fasterxml.jackson</whitelist-package>
</glassfish-web-app>

The whitelist syntax is simple: Define the name of the package which contains the classes in question. For example writing com.google would whitelist all Google libraries included on the server, while writing com.google.guava would only whitelist the Google Guava library instead.

Extreme Classloading Isolation

Community
  • 1
  • 1
Mike
  • 4,852
  • 1
  • 29
  • 48
  • Thanks for the hint, but i am not sure what i should whitelist here. all packages used by facelets are already whitelisted (Default Whitelisted Classes): com.sun, javax and the package in the error message org.glassfish. It still tries to load JSF externaly and the error is still there. – tak3shi May 24 '17 at 11:13