Bad Magic Number
843807Jul 15 2004 — edited Jul 16 2004 I have a very strange problem with my webapp, it has an applet and associated jar file in the webapp root directory. The applet communicates with a servlet (in the classes directory). The webapp when deployed works fine with this setup.
The problem arises once I try to make my webapp more secure by introducing FORM based HTTP authentication code in my web.xml of my webapp. When the webapp is redeployed with appropriate changes to web.xml, and tomcat-users.xml, the applet fails to load reporting 'Bad Magic Number' .So I backtrack to restore my webapp to the previously "fine-working" situation and it does work.
All I could figure out by repeatedly repeating the above two steps is that the small portion of the code that I introduce in web.xml is preventing the correct loading of the applet.
Can any one please help me make the applet work along with the HTTP authentication.
The portion of code that I add to web.xml to implement HTTP authentication
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>login</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.htm</form-login-page>
<form-error-page>/error.htm</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>login</role-name>
</security-role>
I have gone thru numerous forums on 'Bad Magic Number' and how an improper transfer to web server, ASCII based instead of binary, can lead to such an error. I can assure that this has nothing to do with my problem as the applet is not moved at all, and that changes to web.xml are actually affecting the results.