如何使用java EE

时间:2017-12-06 06:48:07

标签: java jboss wildfly keystore

我试图从我的standalone.xml中读取密钥库的属性值,即:path,relative-to,key-password,keystore-password。我正在使用wildfly服务器。

我正在使用这样的东西:

  Object keyStore = ManagementFactory
                        .getPlatformMBeanServer()
                        .getAttribute(
                                new ObjectName("jboss.as:security-realm=ApplicationRealm"),
                                "keystore-password");


 <management>
        <security-realms>
.....
.....

     <security-realm name="ApplicationRealm">
                    <server-identities>
                        <ssl>
                            <keystore path="..\..\..\ssl\KeyStore.jks" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
                        </ssl>
                    </server-identities>
                    <authentication>
                        <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                        <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
                    </authentication>
                    <authorization>
                        <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
                    </authorization>
         </security-realm>
 </security-realms>
 </management>

但它给我这个例外:

12:13:11,255 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /app/v1/login: org.jboss.resteasy.spi.UnhandledException: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key 403-01
    at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:77)
    at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:220)
    at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:175)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:418)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

任何人都可以帮我解决这个问题吗? 我知道我是以错误的方式做到这一点,但最终我在谷歌搜索,无法找到正确的方法。实际上每个例子都带有带元素标签的name选项。

<student name="abc">
<age gender="female" valid=true/>
<age gender="male" valid=true/>   
</student>

Object keyStore = ManagementFactory
                        .getPlatformMBeanServer()
                        .getAttribute(new 
                         ObjectName("jboss.as:student=abc,age=female"),"valid");

但是,在我的xml示例&#34; name&#34;属性不存在它唯一的存在

<security-realm name="ApplicationRealm">

0 个答案:

没有答案