Announcement Announcement Module
Collapse
No announcement yet.
STS 3.5 - MVC template problem - log4j.dtd not found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS 3.5 - MVC template problem - log4j.dtd not found

    Hi,

    I created a MVC template project and upon building the following error message occurs (no code changes at all from my side):

    The file cannot be validated as the XML Schema "<...>/SpringProjects\com.red1.example1\src\test\resource s\log4j.dtd (The system cannot find the file specified)" that is specified as describing the syntax of the file cannot be located.

    The line to which this error message is attached is line 2 in the log4j.xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    It occurs twice, once for the /src/test directory and once for the /src/main directory.

    Has anyone seen this and knows the source of the problem and possibly solution?

    Thanks,

    Christoph

  • #2
    I'm having the same issue. I've tried configuring log4j.dtd in the XML Catalog, but this doesn't seem to resolve the issue. If I remove the DOCTYPE declaration, I then get another complaint about not having a validation schema or DTD. I'd really like to get these warnings to resolve so I don't start out a project with useless warnings and what not to clutter up my build output. So how do we make these go away?

    Comment


    • #3
      Christoph, Rick,

      you can fix this by manually adding new XML catalog entry to STS. Open the preferences and navigate XML -> XML Catalog and click add to the following entry:

      Location: jar:file:/Users/cdupuis/springsource/sts-2.2.1.RELEASE/plugins/org.apache.log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd (you need to modify this to reflect your installation path
      Key Type: Public ID
      Key: -//LOGGER

      Now click OK and if everything goes well you see the new entry the User Specified Entries with no red cross indicating an issue.

      Christian

      Comment


      • #4
        I'm on Windows and installed to C:\springsource. I specified the URL for location as:

        jar:file:/c:/springsource/sts-2.2.1.RELEASE/plugins/org.apache.log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd

        This doesn't seem to resolve the issue. I also tried a hard path to log4j.dtd in my log4j installation and got the same result (i.e. a lack of results . I've even set the entry and stopped and restarted STS.

        BTW, note that I don't get the red cross error icon, just a yellow "caution" icon. I also get build warnings for each of the log4j.xml files in my project.

        Any idea on why this isn't working? I can provide you with any run-time or configuration data you'd like...

        Thanks!

        Comment


        • #5
          Any other thoughts on this? I still have this issue on all of the log4j.xml files in the various projects in my workspace.

          Comment


          • #6
            Rick,

            I just tried it on a windows machine with the settings that you posted and it works for me.

            Originally posted by rherrick View Post
            BTW, note that I don't get the red cross error icon, just a yellow "caution" icon.
            Are you saying that the XML Catalog entry is annotated with a yellow warning icon? That shouldn't be the case.

            I needed to edit and save my log4j.xml to get the changes picked up by the WTP validation infrastructure.

            Christian

            Comment


            • #7
              OK, that worked. I had to not just edit and save the log4j.xml, but actually cut ALL of the text out of it and save it. That made the warning icon go away. I then pasted the text back into the file, saved it again, and the icon did not re-appear.

              That seems like less than optimal behavior (i.e. the warnings should go away upon adding the entity to the XML Catalog and/or the file should be revalidated and cleared upon a new build), but at least it does clear those warnings!

              Should this behavior be filed as a defect against STS?

              Thanks for the help, Christian!

              Comment


              • #8
                Originally posted by chbussler View Post
                Hi,
                The file cannot be validated as the XML Schema ...
                <!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
                ...

                Originally posted by Christian Dupuis View Post
                Christoph, Rick,
                you can fix this by manually adding new XML catalog entry to STS...
                Location: jar:file:/Users/cdupuis/springsource/sts-2.2.1.RELEASE/plugins/org.apache.log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd (you need to modify this to reflect your installation path
                Key Type: Public ID
                Key: -//LOGGER
                Christian
                Hi Christian,
                Is it possible to fixed a similar problem with the entry
                <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">?

                STS/Eclispe still require to use the valid Key in the XML entry. Leaving the Key empty or giving the "log4j.dtd" as the Key doesn't work, due to Eclipse error:
                "The key should be a qualified URI"

                Thanks
                Alex
                Last edited by alexk-il; Mar 10th, 2010, 07:56 AM. Reason: corrupt HTML tags

                Comment


                • #9
                  Originally posted by Christian Dupuis View Post
                  Christoph, Rick,

                  you can fix this by manually adding new XML catalog entry to STS. Open the preferences and navigate XML -> XML Catalog and click add to the following entry:

                  Location: jar:file:/Users/cdupuis/springsource/sts-2.2.1.RELEASE/plugins/org.apache.log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd (you need to modify this to reflect your installation path
                  Key Type: Public ID
                  Key: -//LOGGER

                  Now click OK and if everything goes well you see the new entry the User Specified Entries with no red cross indicating an issue.

                  Christian
                  that fixed the warning problem, thanks!.. but now, i got this in a red icon:

                  The content of element type "log4j:configuration" must match "(renderer*,appender*,plugin*,
                  (category|logger)*,root?,(categoryFactory|loggerFa ctory)?)".
                  what can i do now?

                  Comment


                  • #10
                    Originally posted by Christian Dupuis View Post
                    Christoph, Rick,

                    you can fix this by manually adding new XML catalog entry to STS. Open the preferences and navigate XML -> XML Catalog and click add to the following entry:

                    Location: jar:file:/Users/cdupuis/springsource/sts-2.2.1.RELEASE/plugins/org.apache.log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd (you need to modify this to reflect your installation path
                    Key Type: Public ID
                    Key: -//LOGGER

                    Now click OK and if everything goes well you see the new entry the User Specified Entries with no red cross indicating an issue.

                    Christian
                    Following this recommendation everything was looking good until I tried to put in the "...log4j_1.2.13.v200903072027.jar!/org/apache/log4j/xml/log4j.dtd" I can specify the jar file. However, I cannot add the "!/org/apache..." since it seems to be looking for a file only in the "Location"

                    How do you put in the "...!/org..." ?

                    Thanks!

                    Comment


                    • #11
                      Hi!

                      After you chose the log4j.jar from your file system and added this "!/org..." to it, remember to put "jar:file:" in front of that all.

                      HTH,
                      Martin

                      Comment


                      • #12
                        This was first reported (at the latest) in 2009. It's now many releases of STS later and this is still happening. Is there any chance that this is ever going to get fixed and not require manually making this configuration change every single time you create a new workspace? Should I create a SpringSource JIRA issue for this?

                        Comment


                        • #13
                          Hey!

                          I am sorry that this takes so long, but we are working on getting this done for the upcoming 2.7.0 release (expected for beginning of July).

                          -Martin

                          Comment


                          • #14
                            Originally posted by Martin Lippert View Post
                            I am sorry that this takes so long, but we are working on getting this done for the upcoming 2.7.0 release (expected for beginning of July).
                            Excellent! I'm not trying to grumble, but, as you can probably guess, I just had to create a new workspace and ended up having to look back at this thread to be reminded how to fix the issue.

                            And I may not be trying to grumble, but of course I am grumbling

                            Thanks for the (soon-to-be) fix!

                            Comment


                            • #15
                              Hey Rick!

                              No problem at all, reminding us of such things is never a bad idea...

                              Cheers,
                              -Martin

                              Comment

                              Working...
                              X