具有PDAuthorizationContext的Java 8 MalformedInputException(java.util.Locale,java.net.URL)

时间:2019-07-15 18:15:21

标签: authentication java-8 websphere-9

最近,当我将WebSphere Server从WAS 7(运行Java 6)更新为WAS 9.0.0.10 [ND 9.0.0.10](运行Java 8)时,遇到了:

java.lang.NoClassDefFoundError: sun.io.MalformedInputException

构造a时出错:

new PDAuthorizationContext(java.util.Locale, java.net.URL)

班。

经过调查,我了解到Java 8已弃用Sun.io类,这导致了我的错误。有没有其他方法可以编码我的类以创建PDAuthorizationContext对象,而不必导入旧版本的rt.jar库。

public class AuthorizationContext {

    private static final String PROPERTIESFILE = "file:config/PdPerm.properties";
    private static PDAuthorizationContext authorizationContext = null;

    private AuthorizationContext() {
        super();
    }

    public static PDAuthorizationContext getAuthorizationContext() throws Throwable{
        if(authorizationContext==null){
            authorizationContext = new PDAuthorizationContext(Locale.getDefault(),new URL(PROPERTIESFILE));
        }

        return AuthorizationContext.authorizationContext;
    }   
}

下面是我在WAS 9.0.0.10 Server上运行代码时抛出的异常的片段:

   SystemOut: authorizationContext: null 
   SystemOut: Locale.getDefault(): en_US 
   SystemOut: PdPerm.properties: file:config/PdPerm.properties
   SystemOut: PdPerm.properties Permissions: canRead: true, canWrite: true
ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause /MainMenu.jsp: com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.Exception: java.lang.NoClassDefFoundError: sun.io.MalformedInputException
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:733)
com.ibm._jsp._MainMenu._jspService(_MainMenu.java:682)
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:220)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1124)
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4217)
com.ibm.ws.webcontainer.webapp.WebAppImpl.handleRequest(WebAppImpl.java:2208)

所有评论/帮助将不胜感激,因为WebSphere Authorization对我来说是一个新概念。

0 个答案:

没有答案