Announcement Announcement Module
Collapse
No announcement yet.
Problem with Spring Integration in Action sample code with STS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Spring Integration in Action sample code with STS

    Ok I just downloaded a fresh new copy of the newest STS (although I noticed this problem exists with older versions as well) and imported some sample code as an existing maven project into STS. The sample code is from the Spring Integration in Action book which I am reading right now (good book btw).

    Anyways after importing the project and fixing a couple problems like duplicate dependencies and a missing version for the maven compiler plugin in the root POM the projects build OK, but one module (integration) is exhibiting these annoying red x's (warnings).

    You see things like

    Description Resource Path Location Type
    cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'header'. bookings.xml /integration/src/main/resources line 25 XML Problem

    There are 32 such validation errors listed in my problems view.

    I read the Sticky in this forum and none of that seems to apply to me being this is a new installation of STS and a new workspace. I did notice that under preferences->bean support -> namespaces I do not see any Spring integration namespaces listed is that a bug?

    I do however see the namespaces listed when I open one of the config files using the Spring Config Editor.

    To reproduce this just download STS and go and import the sample code as an existing maven project.

    The sample code can be found here:
    https://github.com/SpringSource/Spri...tion-in-Action

    If anyone has any idea how to fix this, I am all ears. I know they are just warnings but all the red makes them look like errors and it drives me nuts. Also content assist obviously does not work for the things in question either which makes it seem like I am misusing them.

  • #2
    OK so the problem is that it is validating against the 1.0 schema if I change it to

    Code:
    http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
    then it works. This is a problem though as every time a new version comes out I have to update 100 xml files.

    Comment


    • #3
      I typically disable all XML validators. Not sure what's going on there but disabling them eliminates all of those warnings, speeds up STS while not costing you any loss of functionality (e.g., code assist, etc). So go to Preference -> XML and disable all validators. Also disable Spring validarors as well.

      Comment


      • #4
        Thanks Oleg,

        I tried your recommendation but I must have missed something. I disabled a bunch of validation in about 4 different places but it did not seem to have an effect. I also deleted the errors from the problems window and did a project clean after each change.

        As to why I think it has something to do with when I said this

        preferences->bean support -> namespaces I do not see any Spring integration namespaces listed
        There is an option in that menu stating 'Use Highest XSD version that is available on the projects classpath' . Every Spring namespace under the sun is listed there except for the Spring integration ones. I think this may be the reason I only have this issue with Spring Integration stuff. I don't know why STS is not picking these up.

        Thanks,
        Bill

        Comment


        • #5
          Hey Bill!

          The underlying problem is related to XSD resolution in Eclipse/STS. We try to resolve those XSDs relative to your projects classpath to allow an exact resolution based on the libraries that you have in your project rather that something that is configured globally in your IDE. However, there are a few places in the webtools platform (the one we are using for the XML editors, etc.), especially for the unversioned namespace definitions, where the platform falls back to general XSD resolution over the internet (or the embedded catalog). And the unversioned XSD for Spring integration on the internet is an old one (I guess it is the 1.0 version).

          There are several ways to workaround this problem:
          - you can use versioned namespace definitions (but I understand that this is not always a good choice)
          - you can also try to add the one you are using to the XML catalog (under preferences), that should help the platform to use the right unversioned XSD.

          HTH,
          Martin

          Comment


          • #6
            Hey Martin thanks for the reply. When adding a user entry to the XML catalog I did not see a way to specify a URI. How can I get the XSD out of the JAR in my maven repository, or do I just need to extract it and put it somewhere?

            Also why is it that every other Spring namespace other than the integration ones show up in the Preferences->Beans Support->Namespaces list? Is there something that is different with Spring integration vs the other Spring projects? This particular issue does not seem related to the explanation you gave unless I am misunderstanding something. For this issue it seems to me that it's not that the wrong one is in that list there just are not any in that list.

            Comment


            • #7
              Martin,

              Thank you very much for your response, and kudos for the great effort in doing STS a good tool for programming.

              Originally posted by Martin Lippert View Post

              [...] to workaround this problem:
              - you can use versioned namespace definitions (but I understand that this is not always a good choice)
              [...]
              The versioned namespace defitions is almost never a good solution (in fact, the new version 2.2 is about to be released)

              But it's not that dificult to configure a spring application context xml file in STS: just go to the "Namespaces" tab.

              (Actually, I changed the namespaces only to saw the configuration free of errors, but I'm currently using the not versioned XSD names)

              Comment


              • #8
                Hey!

                Originally posted by wgorder View Post
                How can I get the XSD out of the JAR in my maven repository, or do I just need to extract it and put it somewhere?
                I think you can point to the XSD in your maven repo JAR file.

                Originally posted by wgorder View Post
                Also why is it that every other Spring namespace other than the integration ones show up in the Preferences->Beans Support->Namespaces list? Is there something that is different with Spring integration vs the other Spring projects? This particular issue does not seem related to the explanation you gave unless I am misunderstanding something. For this issue it seems to me that it's not that the wrong one is in that list there just are not any in that list.
                Yes, you are right, that is unrelated to my previous comment. I have to investigate this further and will let you when I debugged that piece.

                Thanks,
                Martin

                Comment

                Working...
                X