java “URI有一个权限组件”是什么意思?

omvjsjqw  于 2023-02-02  发布在  Java
关注(0)|答案(7)|浏览(138)

我尝试在NetBeans 6.8上构建Java Web项目,但遇到以下错误:
模块尚未部署。
它指向我的build-impl.xml文件,第577行:

<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

GlassFish v3错误日志显示:

SEVERE: Exception in command execution : java.lang.IllegalArgumentException: URI has an authority component
java.lang.IllegalArgumentException: URI has an authority component
  at java.io.File.<init>(File.java:368)`..., etc.
  • “URI有一个权限组件”* 是什么意思?
ercv8c1e

ercv8c1e1#

授权是URI的一部分。您的错误表明它不需要授权。授权部分如下所示,它是URL的网站部分。
来自URIs上的RFC 3986:
以下是URI及其组成部分的示例:

foo://example.com:8042/over/there?name=ferret#nose
     \_/   \______________/\_________/ \_________/ \__/
      |           |            |            |        |
   scheme     authority       path        query   fragment
      |   _____________________|__
     / \ /                        \
     urn:example:animal:ferret:nose

所以有两种格式,一种有权威,一种没有。关于斜杠:
“当权限不存在时,路径不能以两个斜杠开始
字符(“//”)。”
源:https://tools.ietf.org/rfc/rfc3986.txt(搜索文本'*authority is not present,路径不能以两个斜杠 *'开始)

roejwanj

roejwanj2#

解决方法很简单,URI格式不正确(因为我的项目位于“\”UNC路径上)。当我使用本地工作空间时,这个问题得到了修复。

zyfwsgd6

zyfwsgd63#

翻到GlassFish输出标签,它会给予你更好的信息。Netbeans给你这个一般性的错误,但是Glassfish给你细节。当我得到这个通常是在我的JSP或XML文件中的一个打字错误...

tvokkenx

tvokkenx4#

我遇到了同样的问题(NetBeans 6. 9. 1),修复非常简单:)
我意识到NetBeans没有创建META-INF文件夹,因此没有找到context.xml,所以我在主项目文件夹下创建了META-INF文件夹,并创建了包含以下内容的文件context.xml

<?xml version="1.0" encoding="UTF-8"?>
    <Context antiJARLocking="true" path="/home"/>

而且它运行:)

dly7yett

dly7yett5#

我发现应用程序的URL与Sun GlassFish中的一个模块冲突,因此,在文件sun-web.xml中,我将其重命名为/servlets-samples。
它现在正在发挥作用。

igetnqfo

igetnqfo6#

我也面临着类似的问题,而在Affable Bean电子商务网站的开发工作。我收到了一个错误:
模块尚未部署。
我检查了sun-resources.xml文件,发现了导致错误的以下语句。

<resources>
    <jdbc-resource enabled="true"
                   jndi-name="jdbc/affablebean"
                   object-type="user"
                   pool-name="AffableBeanPool">
    </jdbc-resource>

    <jdbc-connection-pool allow-non-component-callers="false"
                          associate-with-thread="false"
                          connection-creation-retry-attempts="0"
                          connection-creation-retry-interval-in-seconds="10"
                          connection-leak-reclaim="false"
                          connection-leak-timeout-in-seconds="0"
                          connection-validation-method="auto-commit"
                          datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
                          fail-all-connections="false"
                          idle-timeout-in-seconds="300"
                          is-connection-validation-required="false"
                          is-isolation-level-guaranteed="true"
                          lazy-connection-association="false"
                          lazy-connection-enlistment="false"
                          match-connections="false"
                          max-connection-usage-count="0"
                          max-pool-size="32"
                          max-wait-time-in-millis="60000"
                          name="AffableBeanPool"
                          non-transactional-connections="false"
                          pool-resize-quantity="2"
                          res-type="javax.sql.ConnectionPoolDataSource"
                          statement-timeout-in-seconds="-1"
                          steady-pool-size="8"
                          validate-atmost-once-period-in-seconds="0"
                          wrap-jdbc-objects="false">

        <description>Connects to the affablebean database</description>
        <property name="URL" value="jdbc:mysql://localhost:3306/affablebean"/>
        <property name="User" value="root"/>
        <property name="Password" value="nbuser"/>
    </jdbc-connection-pool>
</resources>

然后我把语句改成了下面这样,这很简单,也很有效。我能够成功地运行这个文件。

<resources>
    <jdbc-resource enabled="true" jndi-name="jdbc/affablebean" object-type="user" pool-name="AffablebeanPool">
        <description/>
    </jdbc-resource>
    <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="AffablebeanPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
        <property name="URL" value="jdbc:mysql://localhost:3306/AffableBean"/>
        <property name="User" value="root"/>
        <property name="Password" value="nbuser"/>
    </jdbc-connection-pool>
</resources>
798qvoo8

798qvoo87#

在尝试了一个名为“jsf-blank”的 backbone 项目后,它没有演示XHTML文件的这个问题;我得出结论,我的项目中存在未知问题。我的解决方案可能不太优雅,但它节省了时间。我备份了代码和其他已经开发的文件,删除了项目,并重新创建了项目。到目前为止,我已经添加回了大部分文件,看起来相当不错。

相关问题