Arquillian 和 Tomcat6 问题

发布于 2024-12-13 18:09:20 字数 1965 浏览 1 评论 0原文

我有两个关于 Arquillian 和 Tomcat 的问题:

- 我的 arquillian 测试失败,并显示以下错误消息:

org.jboss.jsfunit.example.hellojsf.HelloJSFTest 已用时间:0 秒 <<<<错误! org.jboss.arquillian.container.spi.ConfigurationException: 无法连接到 Tomcat 管理器。服务器命令 (/deploy?path=%2Ftest) 失败,响应代码 (401) 和 响应消息(非自动)。请确保您提供了 能够访问 Tomcat 管理器的用户的正确凭据 应用。这些凭证可以在 Arquillian 中指定 容器配置为“user”和“pass”属性。用户必须 在 tomcat-users.xml 文件中指定了适当的角色。

仅供参考,我的 arquillian.xml 文件如下:

<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      <engine>
        <property name="deploymentExportPath">target/</property>
         <property name="jmxPort">8099</property>
        <property name="user">admin</property>
        <property name="pass">admin75</property>
    </engine>

    <defaultProtocol type="Servlet 2.5" />
     <container qualifier="tomcat-remote">
        <configuration>
            <property name="jmxPort">8099</property>
            <property name="user">admin</property>
            <property name="pass">admin75</property>
        </configuration>
    </container>
</arquillian>

我正在尝试为 tomcat 6 调整示例应用程序。任何人都可以帮忙吗?

-Arquillian什么时候支持tomcat 7?

问候,

J.

tomcat-users.xml:

<tomcat-users>
  <role rolename="manager"/>
  <role rolename="tomcat"/>
  <role rolename="admin"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="admin" password="admin75" roles="manager,admin"/>

</tomcat-users>

I have two questions regarding Arquillian and Tomcat:

-My arquillian tests fail with the following error message:

org.jboss.jsfunit.example.hellojsf.HelloJSFTest Time elapsed: 0 sec
<<< ERROR! org.jboss.arquillian.container.spi.ConfigurationException:
Unable to connect to Tomcat manager. The server command
(/deploy?path=%2Ftest) failed with responseCode (401) and
responseMessage (Non-Autorisé). Please make sure that you provided
correct credentials to an user which is able to access Tomcat manager
application. These credentials can be specified in the Arquillian
container configuration as "user" and "pass" properties. The user must
have appripriate role specified in tomcat-users.xml file.

FYI my arquillian.xml file is as follows:

<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      <engine>
        <property name="deploymentExportPath">target/</property>
         <property name="jmxPort">8099</property>
        <property name="user">admin</property>
        <property name="pass">admin75</property>
    </engine>

    <defaultProtocol type="Servlet 2.5" />
     <container qualifier="tomcat-remote">
        <configuration>
            <property name="jmxPort">8099</property>
            <property name="user">admin</property>
            <property name="pass">admin75</property>
        </configuration>
    </container>
</arquillian>

I am trying to adapt the sample app for tomcat 6. Can anyone please help?

-When will Arquillian support tomcat 7?

Regards,

J.

tomcat-users.xml:

<tomcat-users>
  <role rolename="manager"/>
  <role rolename="tomcat"/>
  <role rolename="admin"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="admin" password="admin75" roles="manager,admin"/>

</tomcat-users>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南笙 2024-12-20 18:09:20

这条消息

无法连接到 Tomcat 管理器。服务器命令 (/deploy?path=%2Ftest) 失败,响应代码 (401) 和响应消息(非自动)。

表示以下情况之一为 true:

  • Tomcat 安装使用的 tomcat-users.xml 文件没有 admin 用户(您在 >arquillian.xml),
  • 或者 admin 用户未映射到 Tomcat 6 中的 manager 角色,或者 manager-script Tomcat 7 中的角色。

Arquillian 何时支持 tomcat 7?

Arquillian 支持 Tomcat 7 作为嵌入式或托管容器。该文档不是最新的(截至目前),但配置参数或多或少与 Tomcat 6 中的嵌入式和托管等效项相同。用于

  • 托管 Tomcat 7 实例的工件 ID 是 org. jboss.arquillian.container:arquillian-tomcat-management-7
  • 嵌入式 Tomcat 7 实例是 org.jboss.arquillian.container:arquillian-tomcat-embedded-7。

截至今天,1.0.0.CR2 是最新的稳定版本。如果您想针对开发版本进行工作,可以使用1.0.0.Final-SNAPSHOT


此外,您还可以从 arquillian.xml 文件中省略多个冗余属性。更干净的配置如下所示:

<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      <engine>
        <property name="deploymentExportPath">target/</property>
    </engine>

    <container qualifier="tomcat-remote">
        <configuration>
            <property name="jmxPort">8099</property>
            <property name="user">admin</property>
            <property name="pass">admin75</property>
        </configuration>
    </container>
</arquillian>

This message

Unable to connect to Tomcat manager. The server command (/deploy?path=%2Ftest) failed with responseCode (401) and responseMessage (Non-Autorisé).

indicates that one of the following is true:

  • the tomcat-users.xml file used by your Tomcat installation does not have the admin user (that you've specified in arquillian.xml),
  • or the admin user is not mapped to the manager role in Tomcat 6, or the manager-script role in Tomcat 7.

When will Arquillian support tomcat 7?

Arquillian supports Tomcat 7, as an emebedded or a managed container. The documentation is not up to date (as of now), but the configuration parameters are more or less the same as the embedded and managed equivalents in Tomcat 6. The artifact Id to use for

  • a managed Tomcat 7 instance is org.jboss.arquillian.container:arquillian-tomcat-managed-7.
  • an embedded Tomcat 7 instance is org.jboss.arquillian.container:arquillian-tomcat-embedded-7.

As of today, 1.0.0.CR2 is the latest stable release. You can use 1.0.0.Final-SNAPSHOT, if you want to work against the development build.


Also, you can omit several redundant properties from your arquillian.xml file. A cleaner configuration would look like:

<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      <engine>
        <property name="deploymentExportPath">target/</property>
    </engine>

    <container qualifier="tomcat-remote">
        <configuration>
            <property name="jmxPort">8099</property>
            <property name="user">admin</property>
            <property name="pass">admin75</property>
        </configuration>
    </container>
</arquillian>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文