8 Replies Latest reply on Sep 24, 2012 4:55 AM by hchiorean

    Working with internationalized content

    oranheim

      Hi,

       

      I need to manage content that is localized for various language. My use case is quite simple. I have an article that is stored in the repo and it needs to be available in English and Norwegian.

       

      What best practices should apply here? Does JCR or ModeShape have any built-in support for this?

       

      Ove

        • 1. Re: Working with internationalized content
          rhauch

          The JCR 2.0 specification doesn't really define much for how internationalized or localized content can/should be stored. Section 3.7.11.9 defines the "mix:language" mixin, and ModeShape has this mixin built-in:

           

          [mix:language] mixin
          - jcr:language (string)
          

           

          The specification doesn't really describe how it can or should be used, and ModeShape doesn't offer any additional functionality. This page shows one example of what applications can do with it.

           

          The JSR-333 (aka, JCR 2.1) expert group has an outstanding issue to better handle and standardize more functionality in this area, but the issue has not yet been worked on.

           

          Does anyone else have any suggestions? If so, please share for the benefit of the community. If there's anything we can include in ModeShape to make I18n and L10n easier/better, please let us know.

           

          Best regards,

           

          Randall

          • 2. Re: Working with internationalized content
            oranheim

            I'm getting this error when setting jcr:language property to 'en_US':

             

            <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >

             

            What values are allowed?

            • 3. Re: Working with internationalized content
              rhauch

              What you're seeing is the result of setting the Java locale (likely needed for your application), and not related to using JCR's "jcr:language" property.

               

              The "org.modeshape.jcr.JcrI18n" class is the internationalization framework used internally for ModeShape log messages and exception messages also uses the Java locale. This internal i18n framwork just tries to find language bundles with the specified extension, and if the specified bundle can't be found a warning should be logged and the i18n framework uses the default locale.

               

              But you're saying your getting an error? If so, that's a bug and should be reported. Are you getting an exception or just a log message?

              • 4. Re: Working with internationalized content
                oranheim

                Before the startup sequence of initializing modeshape I resolved the default Java locale as: en_US.

                 

                10:35:09,897 INFO  [com.parts.content.jcr.engine.JcrContentRepositoryStartup] (MSC service thread 1-5) Get Java Default Locale: en_US
                10:35:09,906 INFO  [com.parts.content.jcr.engine.JcrContentRepositoryStartup] (MSC service thread 1-5) ModeShape Configuration URL: vfs:/opt/jboss7/standalone/deployments/musific-next.war/WEB-INF/lib/parts-content-1.0-SNAPSHOT.jar/contentRepository.xml
                10:35:10,153 INFO  [org.modeshape.jcr.RepositoryQueryManager] (modeshape-start-repo-4-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,153 INFO  [org.modeshape.jcr.RepositoryQueryManager] (modeshape-start-repo-2-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,339 INFO  [org.modeshape.jcr.RepositoryQueryManager] (modeshape-start-repo-4-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,339 INFO  [org.modeshape.jcr.RepositoryQueryManager] (modeshape-start-repo-2-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,385 INFO  [org.modeshape.jcr.JcrEngine] (modeshape-start-repo-4-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,389 INFO  [org.modeshape.jcr.JcrEngine] (modeshape-start-repo-2-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,407 INFO  [org.modeshape.jcr.JcrEngine] (modeshape-start-repo-4-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,408 INFO  [org.modeshape.repository.ModeShapeEngine] (modeshape-start-repo-4-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,418 INFO  [org.modeshape.jcr.JcrEngine] (modeshape-start-repo-2-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:35:10,419 INFO  [org.modeshape.repository.ModeShapeEngine] (modeshape-start-repo-2-thread-1) <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                

                 

                So, I'll file an issue on log bundle. I don't get any exceptions, only info messages.

                 

                However, when doing an export/import of workspace, the org.modeshape.jcr.JcrI18n causes the following exception:

                 

                10:40:30,452 SEVERE [javax.faces.event] (http-localhost-127.0.0.1-8080-1) com.parts.commons.exception.PartsException: javax.jcr.PathNotFoundException: <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                    at com.parts.content.mail.management.MailTemplateManagerImpl.doImport(MailTemplateManagerImpl.java:174)
                    at com.parts.content.mail.bean.MailTemplateBean.jcrImport(MailTemplateBean.java:148)
                    at com.parts.content.mail.bean.MailTemplateBean$Proxy$_$$_WeldClientProxy.jcrImport(MailTemplateBean$Proxy$_$$_WeldClientProxy.java)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:597)
                    at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
                    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
                    at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
                    at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
                    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
                    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
                    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
                    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
                    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
                    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
                    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
                    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at com.musific.webapp.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:23)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at com.musific.webapp.filter.ResponseTimeLoggingFilter.doFilter(ResponseTimeLoggingFilter.java:32)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at com.musific.webapp.filter.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:130)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at com.musific.webapp.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:23)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
                    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
                    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
                    at java.lang.Thread.run(Thread.java:680)
                Caused by: javax.jcr.PathNotFoundException: <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                    at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:953)
                    at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:96)
                    at com.parts.content.mail.management.MailTemplateManagerImpl.doImport(MailTemplateManagerImpl.java:169)
                    ... 61 more
                
                10:40:30,543 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) javax.jcr.PathNotFoundException: <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                10:40:30,544 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:953)
                10:40:30,544 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:96)
                10:40:30,545 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.parts.content.mail.management.MailTemplateManagerImpl.doImport(MailTemplateManagerImpl.java:169)
                10:40:30,545 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.parts.content.mail.bean.MailTemplateBean.jcrImport(MailTemplateBean.java:148)
                10:40:30,546 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.parts.content.mail.bean.MailTemplateBean$Proxy$_$$_WeldClientProxy.jcrImport(MailTemplateBean$Proxy$_$$_WeldClientProxy.java)
                10:40:30,547 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                10:40:30,547 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                10:40:30,547 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                10:40:30,548 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at java.lang.reflect.Method.invoke(Method.java:597)
                10:40:30,548 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
                10:40:30,549 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
                10:40:30,549 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
                10:40:30,550 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
                10:40:30,550 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
                10:40:30,551 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
                10:40:30,551 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
                10:40:30,551 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.component.UICommand.broadcast(UICommand.java:300)
                10:40:30,552 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
                10:40:30,552 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
                10:40:30,553 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
                10:40:30,553 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                10:40:30,554 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                10:40:30,554 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
                10:40:30,554 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
                10:40:30,555 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,555 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
                10:40:30,556 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,556 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,557 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.musific.webapp.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:23)
                10:40:30,557 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,558 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,558 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
                10:40:30,559 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,560 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,560 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
                10:40:30,561 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,561 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,562 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
                10:40:30,562 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,563 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,563 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
                10:40:30,564 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,564 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,564 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.musific.webapp.filter.ResponseTimeLoggingFilter.doFilter(ResponseTimeLoggingFilter.java:32)
                10:40:30,565 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,565 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,566 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.musific.webapp.filter.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:130)
                10:40:30,566 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,567 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,567 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at com.musific.webapp.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:23)
                10:40:30,568 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
                10:40:30,568 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                10:40:30,569 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
                10:40:30,569 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
                10:40:30,570 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
                10:40:30,570 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
                10:40:30,571 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
                10:40:30,571 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                10:40:30,572 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                10:40:30,572 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
                10:40:30,573 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
                10:40:30,573 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
                10:40:30,574 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
                10:40:30,574 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)     at java.lang.Thread.run(Thread.java:680)
                

                 

                I use OSX 10.7.3 with all language bundles installed. The export/import routine is straigth forward:

                 

                @Override
                public void doImport() {
                    Session session = sessionInstance.get();
                    InputStream inputStream;
                    try {
                        inputStream = new FileInputStream(getImportFile());
                    } catch (FileNotFoundException e) {
                        throw new PartsException(e);
                    }
                
                    try {
                        Node rootNode = session.getRootNode();
                        Node templatesNode = rootNode.getNode(MailTemplatePath.TEMPLATES);
                        session.importXML(templatesNode.getPath(), inputStream, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
                    } catch (IOException e) {
                        throw new PartsException(e);
                    } catch (RepositoryException e) {
                        throw new PartsException(e);
                    }
                }
                
                @Override
                public void doExport() {
                    Session session = sessionInstance.get();
                    try {
                        Node rootNode = session.getRootNode();
                        Node templatesNode = rootNode.getNode(MailTemplatePath.TEMPLATES_PATH);
                        FileOutputStream fileOutputStream = new FileOutputStream(getImportFile());
                        session.exportSystemView(templatesNode.getPath(), fileOutputStream, false, false);
                    } catch (RepositoryException e) {
                        e.printStackTrace();
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                

                 

                I write language property to a node simply by doing:

                 

                my.cnd:

                 

                [content:SiteArticle] > nt:unstructured, mix:versionable, mix:language
                    - category (string)
                    - heading (string)
                    - content (string)
                

                 

                Apply language to Node:

                 

                contentNode.setProperty("jcr:language", "en_US");
                

                 

                Querying for nodes based on language works fine, so the only error I get is during import/export.

                 

                Is there a way to configure default lcoale bundle to ModeShape, so I can get the logger messages outputed to console?

                • 5. Re: Working with internationalized content
                  oranheim

                  Please disregard the above issue regarding Export/Import for localized content.

                   

                  It is only the log bundle issue that is the real issue here. The JIRA issue MODE-1431 has been updated accordingly.

                  • 6. Re: Working with internationalized content
                    rhauch

                    UPDATED:

                     

                    I'm having a tough time reproducing your logs. No matter what I've tried, I cannot get the "<Problems were encountered while localizing" messages. Even when I set the default locale to something (e.g., using "Locale.setDefault(Locale.JAPAN)") in one of the first ModeShape classes to be initialized, the ModeShape i18n framework is always able to still find the localization bundles we provide in our JARs.

                     

                    Let's walk through how the code works, using the "org.modeshape.jcr.JcrI18n" bundle mentioned in your log, a default locale of "en_US" and a current locale of "fr_FR". The process is as follows (for each bundle):

                     

                    1. Look for "org.modeshape.jcr.JcrI18n_fr_FR.properties" file on the classpath; if found, load it and localize the string
                    2. Look for "org.modeshape.jcr.JcrI18n_fr.properties" file on the classpath; if found, load it and localize the string
                    3. Look for "org.modeshape.jcr.JcrI18n.properties" file on the classpath; if found, load it and localize the string
                    4. Otherwise fail by reporting the exception

                     

                    But step 3 should never fail, since we provide those resources in our JARs. Have you localized any of our bundles and included them in the classpath?

                     

                    Can you provide a test case that exhibits the failure, including any JVM or System properties you might be setting? If so, please attach it to MODE-1431. Thanks.

                    • 7. Re: Working with internationalized content
                      oranheim

                      Hi Randal,

                       

                      I've upgraded to ModeShape 2.8.3 and now I get an exception.

                       

                      My AS7 module configuration:

                       

                      • Added a module connector/infinispan-5 to AS 7.1.3.Final
                      • Included modeshape-common-2.8.3
                      • Included modeshape-graph-2.8.3
                      • Added module dependency for: javax.api, org.slf4j, org.infinispan, org.joda.time

                       

                      My app depends on the 'org.modeshape.connector.infinispan-5' module (above).

                       

                      With 2.8.1, I got the warning referred to in this thread. Now I get an exception that prohibits my deployment succeed:

                       

                      jboss.msc.service.StartException in service jboss.deployment.unit."musific-next.war".component.ContractRepositoryStartup.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
                                at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [classes.jar:1.6.0_35]
                                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_35]
                                at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_35]
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_35]
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_35]
                                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_35]
                                at org.jboss.threads.JBossThread.run(JBossThread.java:122)
                      Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
                                at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:118)
                                at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:133)
                                at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                ... 7 more
                      Caused by: javax.ejb.EJBException: javax.enterprise.inject.CreationException
                                at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:164)
                                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
                                at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:331)
                                at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:57)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                                at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                ... 11 more
                      Caused by: javax.enterprise.inject.CreationException
                                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [classes.jar:1.6.0_35]
                                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [classes.jar:1.6.0_35]
                                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [classes.jar:1.6.0_35]
                                at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [classes.jar:1.6.0_35]
                                at java.lang.Class.newInstance0(Class.java:355) [classes.jar:1.6.0_35]
                                at java.lang.Class.newInstance(Class.java:308) [classes.jar:1.6.0_35]
                                at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:344)
                                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
                                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)
                                at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:341)
                                at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33)
                                at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:45)
                                at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:85)
                                at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:143)
                                at org.jboss.weld.bean.ProducerMethod$ProducerMethodProducer.produce(ProducerMethod.java:136)
                                at org.jboss.weld.bean.AbstractProducerBean$AbstractProducer.produce(AbstractProducerBean.java:319)
                                at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:307)
                                at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68)
                                at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:599)
                                at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:626)
                                at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:108)
                                at com.parts.contract.repository.management.metadata.ContractRepositoryStartup.checkRootNode(ContractRepositoryStartup.java:32)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_35]
                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_35]
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_35]
                                at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_35]
                                at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.3.Final.jar:7.1.3.Final]
                                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
                                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:226)
                                ... 20 more
                      Caused by: javax.jcr.RepositoryException: <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                                at org.modeshape.jcr.JcrEngine$JcrRepositoryHolder.getRepository(JcrEngine.java:825)
                                at org.modeshape.jcr.JcrEngine.getRepository(JcrEngine.java:380)
                                at com.parts.contract.jcr.engine.JcrContractRepositoryStartup.getRepository(JcrContractRepositoryStartup.java:90)
                                at com.parts.contract.jcr.engine.JcrContractRepositoryStartup.produceContentSession(JcrContractRepositoryStartup.java:97)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_35]
                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_35]
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_35]
                                at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_35]
                                at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
                                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
                                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
                                at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
                                at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
                                at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)
                                ... 45 more
                      Caused by: javax.jcr.RepositoryException: <Problems were encountered while localizing internationalization class org.modeshape.jcr.JcrI18n to locale "en_US" >
                                at org.modeshape.jcr.JcrEngine$RepositoryInitializer.call(JcrEngine.java:911)
                                at org.modeshape.jcr.JcrEngine$RepositoryInitializer.call(JcrEngine.java:883)
                                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_35]
                                at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_35]
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_35]
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_35]
                                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_35]
                      Caused by: java.lang.IndexOutOfBoundsException: Index: 5, Size: 4
                                at java.util.ArrayList.RangeCheck(ArrayList.java:547) [classes.jar:1.6.0_35]
                                at java.util.ArrayList.get(ArrayList.java:322) [classes.jar:1.6.0_35]
                                at org.modeshape.graph.connector.base.MapTransaction$Children.get(MapTransaction.java:1109)
                                at org.modeshape.graph.connector.base.MapTransaction$Children$1.next(MapTransaction.java:1188)
                                at org.modeshape.graph.connector.base.MapTransaction$Children$1.next(MapTransaction.java:1180)
                                at org.modeshape.graph.connector.base.Processor.process(Processor.java:314)
                                at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:250)
                                at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:363)
                                at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:235)
                                at org.modeshape.graph.connector.base.Connection.execute(Connection.java:115)
                                at org.modeshape.graph.Graph.execute(Graph.java:288)
                                at org.modeshape.graph.Graph$Batch.execute(Graph.java:4970)
                                at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:1826)
                                at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:1922)
                                at org.modeshape.jcr.JcrEngine.doCreateJcrRepository(JcrEngine.java:682)
                                at org.modeshape.jcr.JcrEngine$RepositoryInitializer.call(JcrEngine.java:900)
                                ... 6 more
                      
                      

                       

                      The JcrI18n class in located in the modeshape-jcr and if I include that into the jboss-module, it won't work at all.

                       

                      Do you have any suggestion on how to circumvent this problem, or should I revert to 2.8.1?

                       

                      Cheers,

                      Ove

                      • 8. Re: Working with internationalized content
                        hchiorean

                        Hi Ove,

                         

                        The stack trace seems to indicate the problem is at repository startup, when the predefined node types try to be registered. Can you have a look at your ModeShape configuration file, if it defines something like:

                                 <jcr:nodeTypes>

                                        <mode:resource>....</mode:resource>

                                    </jcr:nodeTypes>

                         

                        If it does, can you try commenting that section out and see if you still get the problem ? Thanks.