Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-7135

Sling Model object can't be instantiated on Java 9

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • Extensions
    • None

    Description

      HtlTest.testScriptWithModelUseBean fails with:

      org.apache.sling.scripting.sightly.SightlyException: Identifier org.apache.sling.launchpad.testservices.models.DummyModel cannot be correctly instantiated by the Use API
      	at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:78)
      	at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:69)
      	at org.apache.sling.scripting.sightly.apps.sling.test.htl.model.model_html.render(model_html.java:39)
      	at org.apache.sling.scripting.sightly.java.compiler.RenderUnit.render(RenderUnit.java:48)
      	at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61)
      	at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386)
      	at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
      	at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
      	at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552)
      	at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
      	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
      	at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
      	at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:107)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)
      	at org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:47)
      	at org.apache.sling.launchpad.testservices.filters.NoPropertyFilter.doFilter(NoPropertyFilter.java:25)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
      	at org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:47)
      	at org.apache.sling.launchpad.testservices.filters.SlingFilter.doFilter(SlingFilter.java:25)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
      	at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:138)
      	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
      	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151)
      	at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:234)
      	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
      	at org.apache.sling.junit.impl.servlet.TestLogServlet$TestNameLoggingFilter.doFilter(TestLogServlet.java:257)
      	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
      	at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96)
      	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
      	at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:138)
      	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
      	at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:72)
      	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
      	at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:128)
      	at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
      	at org.eclipse.jetty.server.Server.handle(Server.java:534)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
      	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
      	at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
      	at org.apache.sling.models.impl.ModelAdapterFactory.invokePostConstruct(ModelAdapterFactory.java:832)
      	at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:652)
      	at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:371)
      	at org.apache.sling.models.impl.ModelAdapterFactory.createModel(ModelAdapterFactory.java:238)
      	at org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider.provide(SlingModelsUseProvider.java:126)
      	at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:73)
      	... 65 more
      Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct
      	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
      	at org.apache.sling.launchpad.base.shared.LauncherClassLoader.loadClass(LauncherClassLoader.java:160)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
      	at org.apache.felix.framework.ExtensionManager$ExtensionManagerWiring.getClassByDelegation(ExtensionManager.java:1009)
      	at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1631)
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1561)
      	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)

      Attachments

        Issue Links

          Activity

            People

              karlpauls Karl Pauls
              rombert Robert Munteanu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: