我用jbuilder新建了一个非常简单的webapp程序,这个程序只有一个index.jsp文件,在web.xml文件中设置表单验证或者是basic验证,
如下:
<security-constraint>
<display-name>test</display-name>
<web-resource-collection>
<web-resource-name>test resource</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>test</realm-name>
</login-config>
在运行该程序时,jbuilder总是报错:
ContextConfig[]: No Realm has been configured to authenticate against
ContextConfig[]: Marking this application unavailable due to previous error(s)
程序也运行不起来,我尝试修改了jbuilder自带的tomcat的server.xml文件的realm和jbuilder生成的server8080.xml文件,可是一点用也没有。但是如果我将这个程序打包放在tomcat中,启动tomcat却能看见效果。
这是为什么?我应该怎么做才能使程序能在jbuilder中直接运行起来呢?谢谢指教!