ActiveMQ使用的是jetty服务器, 打开conf/jetty.xml文件,找到

<beanid="adminSecurityConstraint"class="org.eclipse.jetty.util.security.Constraint"><propertyname="name"value="BASIC"/><propertyname="roles"value="admin"/><!--setauthenticate=falsetodisablelogin--><propertyname="authenticate"value="true"/></bean>


将property name为authenticate的属性value="true"改为"false",登录http://localhost:8161/admin/时就不会弹出用户名密码要求输入。authenticate的属性value="true"时,控制台的登录用户名密码保存在conf/jetty-realm.properties文件中,内容如下:

##---------------------------------------------------------------------------##LicensedtotheApacheSoftwareFoundation(ASF)underoneormore##contributorlicenseagreements.SeetheNOTICEfiledistributedwith##thisworkforadditionalinformationregardingcopyrightownership.##TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0##(the"License");youmaynotusethisfileexceptincompliancewith##theLicense.YoumayobtainacopyoftheLicenseat####http://www.apache.org/licenses/LICENSE-2.0####Unle***equiredbyapplicablelaworagreedtoinwriting,software##distributedundertheLicenseisdistributedonan"ASIS"BASIS,##WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.##SeetheLicenseforthespecificlanguagegoverningpermissionsand##limitationsundertheLicense.##---------------------------------------------------------------------------#Definesusersthatcanaccesstheweb(console,demo,etc.)#username:password[,rolename...]admin:admin,adminuser:user,user值得注意的是用户名和密码的格式是:用户名:密码,角色名。