- This topic has 12 replies, 4 voices, and was last updated 19 years, 7 months ago by Rhoon.
-
AuthorPosts
-
QASMemberHi,
I’ve just tried to add Struts 1.2 capabilities to our new web application setup and i’m getting
Invalid Struts 1.2 config file : Error on line 5: Element type “struts-config” must be declared.
Before I get the error however, MyEclipse pops up a box giving me the full breakdown of what is in the struts-config, e.g how many beans, how many actions and so fourth.
The following is the existing struts-config file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <!-- - Form Beans --> <form-beans> <form-bean name="testForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="testField" type="java.lang.String" initial="" /> <form-property name="testField2" type="java.lang.String" initial="1234" /> </form-bean> </form-beans> <!-- - Globals --> <global-exceptions /> <global-forwards> <forward name="microsite" path="com.qas.newmedia.internet.layout.microsite" redirect="false" /> </global-forwards> <!-- - Actions --> <action-mappings> <action path="/testValidator" forward="com.qas.newmedia.internet.layout.microsite.testvalidator"/> <action path="/testValidatorSubmit" type="com.qas.newmedia.internet.core.page.action.TestValidatorAction" name="testForm" validate="false" scope="request"> <forward name="testform" path="com.qas.newmedia.internet.layout.microsite.testvalidator" redirect="false" /> </action> <action path="/**" type="com.qas.newmedia.internet.core.page.action.PageAction" /> </action-mappings> <!-- - Controller --> <controller> <set-property property="inputForward" value="true" /> </controller> <!-- - Resource Bundles --> <message-resources null="false" parameter="com.qas.newmedia.internet.core.ApplicationResources" /> <!-- - Tiles --> <plug-in className="org.apache.struts.tiles.TilesPlugin" > <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> <set-property property="moduleAware" value="true" /> </plug-in> <!-- - Validator --> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" /> </plug-in> </struts-config>
Riyad KallaMemberCan you please post all the information we request in the [URL=http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug. Thanks.
QASMemberYes, of course, sorry.
Windows 2000, Eclipse 3.1 M6, Build id: I20050401-1645
Fresh latest MyEclipse for M6 install
Additionl plugin: VSS Plugin 1.6
org.eclipse.pde.* : 8
JDK 5.0 Update 3
Tomcat 5.5.9What steps did you take that resulted in the issue?
Created Web Project, synchronized with VSS to get code. This is a small and new Struts 1.2 web app. Choose then to enable Struts on the project. Changed radio button to Struts 1.2. It flags this error despite not making sense since the Struts webapp works in Tomcat and is a valid DOCTYPE and a valid root strust-config element exists.
Are there any exceptions in the Eclipse log file? No.
Cheers, Allistair.-
Riyad KallaMemberAllistair I just loaded up your struts-config file in my setup and it worked fine. Are you behind a web proxy or other proxy that might cause the XML editor to fail from loading the DTD to validate the file against?
schupMemberSame problem here
If I let the wizard create an empty struts config and copy the content from my struts-config file into it it works fine.
schupMemberforgot to mention 🙂
Eclipse 3.0.1 (200409161125)
MyEclipse 200501171200-3.8.4
Windows XP, JDK 1.4.2_07-b05
RhoonMemberSame Error here… ever figure out the problem?
Using:
Red Hat Fedora Core 3
Dell Inspiron 4150
Eclipse 3.0.1 build: 200409161125
Subversion
MyEclipse 3.8.4
java -version: 1.5.0_01
org.eclipse.pde: version 3.0.1Steps:
goto SVN Repository:
Right click on wanted project: select Check Out As…
Select Web Project. Add dependant EJB project, include other libs, goto add struts capabilities.. error is pitched for version 1.2 only. The struts-config.xml file is a valid file. It’s being used in the production release on JBoss4.0.1sp1
Invalid Struts 1.2 config gile found.
org.jdom.JDOMException: error on line 7: Element type “struts-config” must be declared. : Error on line 7: Element type “struts-config” must be declared.–Side note: might want to remove the double error reporting.
Anyone figure a solution to this problem?
Riyad KallaMemberRhoon,
As a temporary workaround, if you add struts caps to the project and let it create a new empty struts-config file, and then copy-paste the contents of your other one into it, does that work for you?I still can’t reproduce this =/, can you post your struts-config file?
RhoonMemberAlso,
If I change the radio button to 1.0, it throws the same type of error but for <global-exceptions/>
RhoonMemberTried doing the empty struts config file. That’s a bunch of ugliness right there.
A completely blank strutsconfig file gives a Premature end of file: Error on line -1.
I hand typed the following:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.2//EN”
“http://struts.apache.org/dtds/struts-config_1_2.dtd”><struts-config>
</struts-config>If I remove the <struts-config> parts, I get the same error as a completely blank file.
——–And I’m back to the same error.
The only work around I have right now is deleting the file and letting myEclipse create it. Which I then have to delete my SVN Copy to merge the changes and paste the changes into the one that the “Add struts” option after I copy in an old copy of the struts-config file because the merge destroyed by my copy and the SVN copy. Which is just a pain and makes a mess of the SVN logs.
I’d paste my struts-config file but I use a Windows Desktop to browse the net, etc.. my laptop is too underpowered to run too much else other than Eclipse.
RhoonMemberTo be clear..
The above test with a blank .xml file was the done by the following:
Create a new web project.
Create a new .xml file, name it struts-config.xml
Open the file. Did the above tests.
So I believe we can rule out the problem is because of a content management system of any kind.
Let me know if I can help out in any other way.
Riyad KallaMemberRhoon,
There is something going on with your setting, I can’t reproduce any of the validation errors or scenarios you gave, so let’s start from the beginning.1) Shut down MyEclipse
2) Go to <workspace dir>\.metadata and erase the .log file
3) Now fire up MyEclipse, go through the motions again of checking out your project and attempting to add Struts Caps to it, did it blow up?
4) if it blew up, go open the new .log file and paste the contents of it here for me.
5) Now go create a new struts-config.xml file (File > new) and put the contents from your post above in it:<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.2//EN”
“http://struts.apache.org/dtds/struts-config_1_2.dtd”><struts-config>
</struts-config>and save it, did it valid? Were there errors? What was the error? Check the log file again, any new entries?
Now, considering that Eclipse and MyEclipse are not certified on JDK 1.5, I would suggest you download JDK 1.4.2_08 and run MyEclipse with that (-vm argument, point it at the java executable). Then re-try the steps above. Additionally I would suggest you upgrade to 1.5.0_03, there were some notable bugs in _01 and _02 that were fixed in _03.
RhoonMemberNo change in anything including the errors…
No errors in the .log file.
The testing with the different JDKs will have to wait.
-
AuthorPosts