Glassfish 5.1 EE 8 (not Jakarta) problem with waffle library to perform HTTP Basic Authentication

12 hours ago 1
ARTICLE AD BOX

When I typed username and password in Google Chrome pop-up I got an exception:

java.lang.AbstractMethodError: com.sun.jna.Structure.getFieldOrder()Ljava/util/List; at com.sun.jna.Structure.fieldOrder(Structure.java:952) at com.sun.jna.Structure.getFields(Structure.java:1006) at com.sun.jna.Structure.deriveLayout(Structure.java:1172) at com.sun.jna.Structure.calculateSize(Structure.java:1097) at com.sun.jna.Structure.calculateSize(Structure.java:1049) at com.sun.jna.Structure.allocateMemory(Structure.java:403) at com.sun.jna.Structure.<init>(Structure.java:194) at com.sun.jna.Structure.<init>(Structure.java:182) at com.sun.jna.Structure.<init>(Structure.java:169) at com.sun.jna.Structure.<init>(Structure.java:161) at com.sun.jna.platform.win32.Sspi$SecHandle.<init>(Sspi.java:496) at com.sun.jna.platform.win32.Sspi$CredHandle.<init>(Sspi.java:536) at waffle.windows.auth.impl.WindowsCredentialsHandleImpl.initialize(WindowsCredentialsHandleImpl.java:92) at waffle.windows.auth.impl.WindowsAuthProviderImpl.acceptSecurityToken(WindowsAuthProviderImpl.java:125) at waffle.servlet.spi.NegotiateSecurityFilterProvider.doFilter(NegotiateSecurityFilterProvider.java:139) at waffle.servlet.spi.SecurityFilterProviderCollection.doFilter(SecurityFilterProviderCollection.java:162) at waffle.servlet.NegotiateSecurityFilter.doFilter(NegotiateSecurityFilter.java:180) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)

My configuration:

Windows 10 Pro Version 22H2 OS Build 19045.6466

1. Glassfish 5.1

2. jdk-8.0.482.8-hotspot

3. Configuration in NetBeans 8.2:

enter image description here

I tried downgrading to Glassfish 5.0 and different versions of jna, waffle but always got the same error.

5. The structure of my project

enter image description here

enter image description here

6. index3.jsp

<jsp:forward page="index.jsf"/>

7. index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <html> <head> </head> <body> <div>test</div> </body> </html>

8. faces-config.xml

<?xml version="1.0" encoding="UTF-8"?> <faces-config 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://java.sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd" version="2.2"> </faces-config>

9. 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"> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value> /WEB-INF/faces-config.xml </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>*.jsf</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index3.jsp</welcome-file> </welcome-file-list> <filter-mapping> <filter-name>SecurityFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>SecurityFilter</filter-name> <filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class> <init-param> <param-name>securityFilterProviders</param-name> <param-value> waffle.servlet.spi.BasicSecurityFilterProvider waffle.servlet.spi.NegotiateSecurityFilterProvider </param-value> </init-param> </filter> </web-app>
Read Entire Article