我是初学者,刚开始使用JSP而且我一直坚持起步。请帮帮我。
我已将catalina.bat
和setclasspath.bat
下载到正确的位置/tomcat/bin/
但仍然得到授权的错误。我看过一篇类似的帖子,并使用此行tomcat-users.xml
<user username="root" password="1234" roles="manager-script"/>
但仍无法成功运行。
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:232)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.lang.IllegalStateException: Access to Tomcat server has not been authorized. Set the correct username and password with the "manager-script" role in the Tomcat customizer in the Server Manager.
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:398)
at org.netbeans.modules.tomcat5.TomcatManager.modules(TomcatManager.java:639)
at org.netbeans.modules.tomcat5.TomcatManager.getAvailableModules(TomcatManager.java:450)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.getAvailableTMIDsMap(TargetServer.java:417)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:372)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:321)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:318)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.processLastTargetModules(TargetServer.java:439)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:174)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.deploy(TargetServer.java:579)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:197)
... 16 more
Caused by: org.netbeans.modules.tomcat5.AuthorizationException
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:399)
... 26 more
BUILD FAILED (total time: 11 seconds)
任何有关这方面的帮助对我来说都是救世主,我对此非常天真。 提前谢谢:)
答案 0 :(得分:20)
我更改了/conf/tomcat-users.xml
的同一服务器错误第1步:
更改tomcat-users.xml
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<user password="tomcat" roles="tomcat,manager-gui" username="tomcat"/>
<user password="tomcat" roles="tomcat,role1" username="both"/>
<user password="tomcat" roles="role1" username="role1"/>
<user password="pass" roles="manager-script,admin" username="me"/>
</tomcat-users>
我添加了两个角色manager-script和admin。
找到对角色的进一步参考第2步:
添加角色后,您需要将这些凭据添加到Netbeans服务器配置中。
选择您的tomcat实例,然后右键单击以查看属性。
现在选择连接选项卡。输入“username”作为我,输入“password”作为pass。
答案 1 :(得分:6)
检查工具&gt;下的代理设置IDE中的选项。
选择No Proxy为我解决了这个问题。
答案 2 :(得分:1)
将xml文件更改为:
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<user password="tomcat" roles="tomcat,manager-gui" username="tomcat"/>
<user password="tomcat" roles="tomcat,role1" username="both"/>
<user password="tomcat" roles="role1" username="role1"/>
<user password="pass" roles="manager-script,admin" username="me"/>
</tomcat-users>
答案 3 :(得分:-1)
如果您正在运行Windows 转到:
C:\用户\ Apostolis \应用程序数据\漫游\的NetBeans \ 8.0 \ Apache的Tomcat的8.0.3.0_base \ CONF
并相应地更改了tomcat-users e.g
<tomcat-users>
<user username="ide" password="Vh4fsrwh" roles="manager-script,admin"/>
</tomcat-users>
之后从Netbeans那里,当被要求输入用户名并通过例如ide,Vh4fsrwh