Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3872

The package sun.util.locale is missing when you use the class java.util.Locale in a JSP file.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.1.Final
    • 7.1.0.Final
    • Web
    • None
    • Hide

      1. Make a WAR o EAR project.
      2. Make a simple JSP which contains a call to the 2 arguments constructor of the class java.util.Locale.

      Show
      1. Make a WAR o EAR project. 2. Make a simple JSP which contains a call to the 2 arguments constructor of the class java.util.Locale.
    • Workaround Exists
    • Hide

      You can fix it editing the file $JBOSS_HOME/modules/sun/jdk/main/module.xml by hand and adding this line into the <module><dependencies><system><paths> node:

      <path name="sun/util/locale"/>

      Show
      You can fix it editing the file $JBOSS_HOME/modules/sun/jdk/main/module.xml by hand and adding this line into the <module><dependencies><system><paths> node: <path name="sun/util/locale"/>

      If you use the 2 arguments constructor of java.util.Locale in a JSP file, it triggers an exception which reports about the absence of classes from the package sun.util.locale.

      This is the stacktrace which I get when I use such constructor in a simple JSP:

      15:49:56,476 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test].[jsp]] (http--0.0.0.0-8443-1) Servlet.service() for servlet jsp threw exception: org.apache.jasper.JasperException: Unable to compile class for JSP:

      An error occurred at line: 7 in the jsp file: /index.jsp
      The type sun.util.locale.LocaleExtensions cannot be resolved. It is indirectly referenced from required .class files
      4:
      5: %><%
      6:
      7: Locale myLocale = new Locale ("es", "ES");
      8:
      9:
      10: %>

      An error occurred at line: 7 in the jsp file: /index.jsp
      The type sun.util.locale.BaseLocale cannot be resolved. It is indirectly referenced from required .class files
      4:
      5: %><%
      6:
      7: Locale myLocale = new Locale ("es", "ES");
      8:
      9:
      10: %>

      Stacktrace:
      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.10.Final.jar:]
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.10.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]

      If I use the same java.util.Locale constructor in a simple class into the same WAR, no exception is thrown however.

      This error is not thrown using the JDK 6, neither in JSP files nor in classes.

            tomazcerar Tomaž Cerar (Inactive)
            negora negora negora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: