6 Replies Latest reply on Mar 7, 2012 3:59 AM by Avor Nadal

    JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?

    Avor Nadal Newbie

      Hello everybody:

       

      I'm still using JBoss AS 5/6. But today, for 2nd time, I've tried to migrate some of my applications to JBoss AS 7 in order to understand how the new class loading system works. One of the main problems which I faced in my 1st attempt, weeks ago, was related to the use of the java.util.Locale class.

       

      If you instantiate java.util.Locale using the constructor with 2 parameters, it causes an exception because a class from the package sun.util.locale.is missing. For example:

       

      Locale myLocale = new Locale ("es", "ES");

       

      If I'm not mistaken, the module sun.jdk should contain this package and everyone under the "sun" root. I've checked its module.xml file but, although I don't understand the structure completely, I've seen that there is no reference to the package sun.util.locale (however, sun.util.calendar is there, for example). I've added one entry to this sun.util.locale, restarted the server and... It worked now!

       

      My question is if this is a bug or there is a good reason so that this package isn't metioned there.

       

      Thank you.

        • 1. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
          Avor Nadal Newbie

          No one knows if this is a bug or an expected behaviour? Thanks.

          • 2. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
            Tomaz Cerar Master

            Hi,

            can you explain a bit more about your application and what are you doing.

            - what kind of aplication

            - what does the structure of deployment archive looks like

            - what are jars in lib of you application

            - any special settings for deployment (jboss-deployment-structure.xml / manifest.mf)

            - what is the stacktrace

             

            cheers,

            tomaz

            • 3. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
              Avor Nadal Newbie

              Hello Tomaz:

               

              Thank you for answering. And apologies for the lack of information in my first message. I'm giving more relevant information just below.

               

              I'm using JBoss AS 7.1.0 running on JDK 1.7.0_01. This error happens in both WAR and EAR deployments. I've made a simple WAR project with one "index.jsp" file inside and it fails too (without containing any .class or .jar file). The content of "index.jsp" is:

              <%@page contentType="text/plain" pageEncoding="UTF-8"

               

                  import="java.util.Locale"

               

              %><%

               

                  Locale myLocale = new Locale ("es", "ES");

               

              %>

               

               

              And this is the exception stack trace:

              17:51:12,146 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test].[jsp]] (http--0.0.0.0-8443-3) 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");

              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");

              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]

               

               

              By the stack trace, I came to the conclusion that the classes of the package sun.util.locale weren't being loaded. That took me to modify $JBOSS_HOME/modules/sun/jdk/main/module.xml and add this line into the node <dependencies>:

               

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

               

               

              This fixed the problem.

               

              I've to remark that this exception is thrown when you instantiate the Locale class with 2 arguments, but not when you do it with 1 argument only.

              • 4. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
                Tomaz Cerar Master

                Hi,

                 

                looks like your conclusion is quite right about missing path in jdk module.

                 

                can you please create jira issue so we can address this properly as it looks like bug either in jsp compiler or jdk7 as this class (sun.util.locale.BaseLocale) can only be found in jdk7.

                can you try reproduce the same on jdk6?

                 

                --

                tomaz

                 

                Message was edited by: Tomaz Cerar

                • 5. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
                  Avor Nadal Newbie

                  Hello again Tomaz:

                   

                  I've opened a JIRA here: https://issues.jboss.org/browse/AS7-3872 . Although I haven't got a good English, I hope that you understand my ticket (I've not much experience with this bug reporting systems either).

                   

                  I believe that you're right about a bug in the JSP compiler. Because I've used the same constructor call in a simple class, into the same WAR file, but it hasn't failed.

                   

                  Furthermore, in the JDK 6 it works well in both cases, in JSP files and also simple classes. So you're also right about that it's exclusive of the JDK 7.

                   

                  Thanks you a lot for your attention .

                  • 6. Re: JBoss 7.1.0: missing dependencies for java.util.Locale. Is it a bug?
                    Avor Nadal Newbie

                    I'm sorry, but I realized that I marked your answer as "Helpful" instead of "Correct". It's fixed now.

                     

                    By the way, the opened JIRA has not received any answer yet. I hope someone watches it .