Announcement Announcement Module
Collapse
No announcement yet.
dm-serve 2.0 problem spring security dependancy breaks admin console Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dm-serve 2.0 problem spring security dependancy breaks admin console

    Hi Guys,

    I'm using dm-server-2.0.0.CI-493.

    I have ported the spring security example to a spring web bundle, and set all project dependencies scope to provided.

    However, when I install the com.springsource.org.apache.xalan-2.7.0.jar, this causes an error when trying to open the splash or the admin console, so navigating to "http://localhost:8080/" causes the stack trace shown, below.

    Anyone got any ideas what is the problem here?

    Many thanks,

    Jeremy.


    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Servlet.init() for servlet splash threw exception
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    com.springsource.server.web.tomcat.ApplicationName TrackingValve.invoke(ApplicationNameTrackingValve. java:37)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:567)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:849)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:454)
    java.lang.Thread.run(Thread.java:619)

    root cause

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.An notationMethodHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.web.servlet.mvc.annotation.Ann otationMethodHandlerAdapter]: Constructor threw exception; nested exception is javax.xml.transform.TransformerFactoryConfiguratio nError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:946)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:890)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:479)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:450)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:286)
    org.springframework.web.servlet.DispatcherServlet. createDefaultStrategy(DispatcherServlet.java:679)
    org.springframework.web.servlet.DispatcherServlet. getDefaultStrategies(DispatcherServlet.java:648)
    org.springframework.web.servlet.DispatcherServlet. initHandlerAdapters(DispatcherServlet.java:479)
    org.springframework.web.servlet.DispatcherServlet. initStrategies(DispatcherServlet.java:337)
    org.springframework.web.servlet.DispatcherServlet. onRefresh(DispatcherServlet.java:325)
    org.springframework.web.servlet.FrameworkServlet.o nApplicationEvent(FrameworkServlet.java:526)
    org.springframework.web.servlet.FrameworkServlet.o nApplicationEvent(FrameworkServlet.java:1)
    org.springframework.context.event.GenericApplicati onListenerAdapter.onApplicationEvent(GenericApplic ationListenerAdapter.java:50)
    org.springframework.context.event.SourceFilteringL istener.onApplicationEventInternal(SourceFiltering Listener.java:97)
    org.springframework.context.event.SourceFilteringL istener.onApplicationEvent(SourceFilteringListener .java:68)
    org.springframework.context.event.SimpleApplicatio nEventMulticaster.multicastEvent(SimpleApplication EventMulticaster.java:97)
    org.springframework.context.support.AbstractApplic ationContext.publishEvent(AbstractApplicationConte xt.java:294)
    org.springframework.context.support.AbstractApplic ationContext.finishRefresh(AbstractApplicationCont ext.java:858)
    org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:419)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 43)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 59)
    org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:340 )
    org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:307)
    org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    com.springsource.server.web.tomcat.ApplicationName TrackingValve.invoke(ApplicationNameTrackingValve. java:37)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:567)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:849)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:454)
    java.lang.Thread.run(Thread.java:619)

  • #2
    Hi Jeremy, this sounds a lot like a bug. Thanks for bringing it to our attention.

    To help us dig into it, I have a quick question: when you say that you installed Xalan 2.7.0, what did you do with the bundle? Place it in the pickup directory? Place it in repository/usr or repository/ext?

    Comment


    • #3
      Hi Andy,

      I placed it in the repository usr.

      I'm doing this always for dependencies collected by maven. Except I always try to check that I do not install jars that are already in ext or elsewhere in the repository.

      Here's the list of jars in my usr:

      com.springsource.org.apache.bcel-5.1.0.jar
      com.springsource.org.apache.commons.logging-1.1.1.jar
      com.springsource.org.apache.log4j-1.2.15.jar
      com.springsource.org.apache.regexp-1.5.0.jar
      com.springsource.org.apache.xalan-2.7.0.jar
      com.springsource.org.apache.xerces-2.8.1.jar
      com.springsource.org.apache.xml.resolver-1.2.0.jar
      com.springsource.org.apache.xml.security-1.0.5.D2.jar
      com.springsource.org.apache.xmlcommons-1.3.3.jar
      com.springsource.org.jasig.cas.client-3.1.8.jar
      com.springsource.org.opensaml-1.1.0.jar
      org.springframework.security.cas-3.0.0.RC1.jar
      org.springframework.security.config-3.0.0.RC1.jar
      org.springframework.security.core-3.0.0.RC1.jar
      org.springframework.security.web-3.0.0.RC1.jar

      Removing the xalan jar and re-starting the dm-server seems to fix the problem, putting it back and re-starting re-introduces it.

      Regards,

      Jeremy.

      Comment


      • #4
        Thanks, Jeremy. Replacing any part of the JVM's XML parsing-related libraries is unfortunately never a completely straightforward thing to do. We'll spend a bit of time looking into this, if nothing else so that we can document it as a known problem. My gut feel at the moment is that the 'right' thing to do will be to place the Xalan jar in the JVM's lib endorsed directory, rather than trying to utilise it as an OSGi bundle.

        Comment


        • #5
          Hi Andy,

          I thought the prefix of com.springsource in the jar name meant that it had been osgified for the dm-server: com.springsource.org.apache.xalan-2.7.0.jar

          Just so I'm clear, are you saying that I should put this jar into my %JAVA_HOME%/lib folder?

          Regards,

          Jeremy.

          Comment


          • #6
            Hi Jeremy,

            I have been looking in to it and have documented the problem under an issue we created in JIRA to track this. https://issuetracker.springsource.com/browse/DMS-2245

            As Andy says, untill we do somehting better you should just put the xalan jar in your %JAVA_HOME%/lib directory. The details of what is going wrong is in the JIRAs child issue https://issuetracker.springsource.com/browse/DMS-2248.

            Chris.

            Comment


            • #7
              Originally posted by jeremy View Post
              Hi Andy,

              I thought the prefix of com.springsource in the jar name meant that it had been osgified for the dm-server: com.springsource.org.apache.xalan-2.7.0.jar
              The com.springsource prefix means that we've modified that JAR file, in this case to update its manifest to be a valid OSGi bundle. It, unfortunately, doesn't mean that it's guaranteed to work in an OSGi environment out of the box. There may be problems with the way the library is written, such as the use of META-INF/services as in this case, that mean it doesn't work properly when combined with OSGi.

              Just so I'm clear, are you saying that I should put this jar into my %JAVA_HOME%/lib folder?
              When I originally replied, I had thought that it needed to go in %JAVA_HOME%/lib/endorsed but, having read around a little more, I think I was mistaken. Apologies. I believe you're right, the jar should be placed in %JAVA_HOME%/lib.

              Comment


              • #8
                Hi Andy,

                With the com.springsource.org.apache.xalan-2.7.0.jar in my %JAVA_HOME%/lib I now get the following:

                Resolver report:
                An Import-Package could not be resolved. Caused by missing constraint in bundle <springsecuritycas_1.0.0>
                constraint: <Import-Package: org.jasig.cas.client.util; version="0.0.0"> constrianed to bundle <com.springsource.org.jasig.cas.client> constrained bundle version range "[3.1.8,3.1.8]"
                An Import-Package could not be resolved. Caused by missing constraint in bundle <com.springsource.org.jasig.cas.client_3.1.8>
                constraint: <Import-Package: org.opensaml; version="[1.1.0,2.0.0)"> constrained bundle version range "0.0.0"
                An Import-Package could not be resolved. Caused by missing constraint in bundle <org.springframework.security.cas_3.0.0.RC1>
                constraint: <Import-Package: org.jasig.cas.client.authentication; version="[3.1.1,3.2.0)"> constrained bundle version range "0.0.0"
                An Import-Package could not be resolved. Caused by missing constraint in bundle <com.springsource.org.opensaml_1.1.0>
                constraint: <Import-Package: org.apache.xml.security; version="[1.0.5.D2,2.0.0)"> constrained bundle version range "0.0.0"
                An Import-Package could not be resolved. Caused by missing constraint in bundle <com.springsource.org.apache.xml.security_1.0.5.D2 >
                constraint: <Import-Package: org.apache.xml.dtm; version="[2.7.0,3.0.0)"> constrained bundle version range "0.0.0"

                I think the problem is the org.apache.xml.dtm which is in the xalan.jar.

                Any ideas?

                Regards,

                Jeremy.

                Comment


                • #9
                  You can make a package that's on the VM's application classpath available for import by a bundle by listing it as a system package. This is done by adding the package name to the org.osgi.framework.system.packages property in the lib/java6-server.profile file.

                  In short, I think you can fix this problem by editing lib/java6-server.profile and adding org.apache.xml.dtm to the org.osgi.framework.system.packages property.

                  Comment


                  • #10
                    Hi Andy,

                    That still doesn't seem to resolve the problem.

                    Please don't take this the wrong way, but could I ask a huge favour:

                    Is it possible someone could point me at instructions to port the spring security cas sample (client) to run on the dm-server as a web bundle?

                    Regards,

                    Jeremy.

                    Comment


                    • #11
                      Is this issue resolved yet?

                      Hi,

                      I noticed in the issue tracker that:

                      DMS-2245 was marked Complete but with no comments.
                      EBR-605 was marked Complete but with a comment to say this was moved to the EBR Jira.

                      It would allow us to move forward with dm-server, as we want to use Xalan for other things beside CAS.

                      Regards,

                      Jeremy.

                      Comment


                      • #12
                        Hi,

                        Sorry for the delay getting back to you, this one slipped past us for a few days.

                        We have had another look at this problem and have a different solution for you to try.
                        This was done on dm Server 2.0.1 but it should work just as well on 2.0.0 if you are still on that.

                        Copy the following bundles from the EBR to the usr repo,

                        com.springsource.org.apache.xalan-2.7.1.jar
                        com.springsource.org.apache.xerces-2.9.1.jar
                        com.springsource.org.apache.xml.resolver-1.2.0.jar
                        com.springsource.org.apache.xml.serializer-2.7.1.jar
                        com.springsource.org.apache.xmlcommons-1.3.4.jar

                        Then edit the lib/java6-server.profile file to add the following line in the boot delegation section near the bottom.

                        org.apache.xalan.*,\

                        Note that the pattern can't go any deeper in to the package as osgi will not match this against 'org.apache.xalan.Foo' for example. It is strictly a package pattern and the '*' will not match any classes or the package 'org.apache.xalan' as it expects the package name to be extended by the '*'.

                        With this in place, clean start the server (-clean option) and everything should start as expected and just work as normal. In the admin console you will see that the xalan bundles you provided are loaded and thanks to boot delegation they are just avaliable for use. You do not need to import the xalan packages/bundles etc... In fact if you do things will start to break.

                        To prove to youself that this is working there is a sample app attached to https://issuetracker.springsource.com/browse/DMS-2245 that you can deploy. All it dose is load a Transformer factory and display it's class on a web page. Have a look at it's source and see it has no package or bundle imports for it. As such you will not be able to see any wirings for it in the OSGi state browser, this is because there arn't any.

                        The only downside to this approach is that you loose the ability to have multiple versions of xalan around. You are bypassing the OSGi classloading approach by using boot delegation.

                        Let me know if this is of any help.
                        Chris.

                        Comment


                        • #13
                          Chris, I have tried your solution, but it didn't work for me.

                          I have modified dmserver/lib/java6-server.profile by adding org.apache.xalan.* to org.osgi.framework.bootdelegation and put the following to dmserver/repository/usr:

                          Code:
                          com.springsource.org.apache.xalan-2.7.1.jar
                          com.springsource.org.apache.xerces-2.9.1.jar
                          com.springsource.org.apache.xml.resolver-1.2.0.jar
                          com.springsource.org.apache.xml.serializer-2.7.1.jar
                          com.springsource.org.apache.xmlcommons-1.3.4.jar
                          After starting dm server with -clean option and accessing http://localhost:8080/xalan/, I get this:

                          Code:
                          javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
                          Also splash/admin apps are suffering from the same problem. I am attaching both profile and log.

                          Comment


                          • #14
                            Hi,

                            OK, this is a little odd now. Before I plow through the logs etc... could you just confirm for me the Java version, dm Server version and operating system you are using.

                            Thanks, Chris.

                            Sorry, could you also check your manifest has no imports for any xalan stuff, although the admin and splash apps should be working with this set up.
                            Last edited by cgfrost; Apr 16th, 2010, 12:04 PM.

                            Comment


                            • #15
                              I get this deploying your org.eclipse.virgo.sample.xalan.war download from the JIRA issue.

                              I am using dm server 2.0.1.RELEASE, Java(TM) SE Runtime Environment (build 1.6.0_19-b04) and Win XP SP3.

                              Comment

                              Working...
                              X