Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Deployment 在Glassfish部署期间,WEB-INF/lib中的JAR库未添加到类路径_Deployment_Classpath_War_Glassfish 3 - Fatal编程技术网

Deployment 在Glassfish部署期间,WEB-INF/lib中的JAR库未添加到类路径

Deployment 在Glassfish部署期间,WEB-INF/lib中的JAR库未添加到类路径,deployment,classpath,war,glassfish-3,Deployment,Classpath,War,Glassfish 3,我对Glassfish和JavaEE是新手,尽管我已经使用Java好几年了。我继承了一个陷入僵局的项目,现在我需要重新开始开发。我正在尝试按原样部署web应用程序,以查看哪些是有效的,哪些是需要注意的。虽然有很多代码可以实现各种功能,但似乎需要注意的第一点是应用程序的部署 我试图部署的web应用程序是MyServer,并且打包在WAR归档中。MyServer中的类引用了MyDatabase中的类,该类实现了MyInterfaces中的接口(InterfaceOne)。MyServer中的类还直接

我对Glassfish和JavaEE是新手,尽管我已经使用Java好几年了。我继承了一个陷入僵局的项目,现在我需要重新开始开发。我正在尝试按原样部署web应用程序,以查看哪些是有效的,哪些是需要注意的。虽然有很多代码可以实现各种功能,但似乎需要注意的第一点是应用程序的部署

我试图部署的web应用程序是
MyServer
,并且打包在WAR归档中。
MyServer
中的类引用了
MyDatabase
中的类,该类实现了
MyInterfaces
中的接口(
InterfaceOne
)。
MyServer
中的类还直接引用了
MyInterfaces
中的
InterfaceOne
MyServer
MyDatabase
MyInterfaces
都是Eclipse中的项目,并使用Maven进行打包。
MyServer
POM文件将
MyDatabase
列为依赖项,而
MyDatabase
的POM文件将
MyInterfaces
列为依赖项。
MyServer
POM文件没有将
MyInterfaces
列为直接依赖项,但我认为这不应该引起问题。Eclipse在相关的
MyServer
类中没有显示任何错误;Eclipse似乎认为Maven依赖项足以定位所有必需的类。

当我通过管理web控制台在Glassfish v3.1.2上部署
MyServer
WAR,然后查看
~Glassfish 3/Glassfish/domains/MyDomain/logs/server.log中的日志时,我遇到以下错误:

[#| 2014-05-29T10:06:02.371+0100 |严重| glassfish3.1.2 |全局| |线程ID=80;|线程名=Thread-2;|未找到类[my/interfaces/InterfaceOne]。加载[Class my.server.ControllerOne]时出错 [#| 2014-05-29T10:06:02.387+0100 |严重| glassfish3.1.2 |全局| |线程ID=80;|线程名=Thread-2;|未找到类[my/interfaces/InterfaceOne]。加载[Class my.server.ControllerOne]时出错

尝试从
MyServer
加载类时,显示了两个与接口相关的错误。如果我从
my.server.ControllerOne
类中删除对
MyDatabase
的引用或从
MyInterfaces
中删除对
InterfaceOne
的直接引用,则上面的一个错误将消失(这是预期的,只是确认错误与引用有关(直接或间接的)来自
MyInterfaces
InterfaceOne

类似的问题包括,并且都提到确保所需的库(
mydatabase.jar
myinterfaces.jar
)位于
MyServer
应用程序WAR存档的
WEB-INT/lib
目录中。但是,如果我检查
MyServer
生成的WAR存档,那么这些库确实位于
WEB-INF/lib/
目录中。如果我检查
~glassfish3/glassfish/domains/MyDomain/applications/MyServer/WEB-INF/lib/
目录部署后,库也在那里。我认为这表明它们已成功地从WAR存档中提取并放置在Glassfish服务器上。关键是库肯定在那里

我所能想到的是,库并没有添加到JVM的类路径中,JVM试图加载
MyServer
的类,但如果Glassfish试图加载应用程序的类,那么它也应该首先加载与应用程序打包的库,不是吗?确实是Oracle Glassfish Server应用程序开发的页面开发指南 3.1.2版表示应用程序的
WEB-INF/lib/
目录被添加到应用程序的类路径中

我还看到其他建议,将web应用程序所需的库放在
~glassfish3/glassfish/domains/MyDomain/lib/ext/
目录中。这可能非常有效,但我的特定库仅是
MyServer
应用程序所需,而不是整个
MyDomain
。据我所知,它应该是e将它们放在我的应用程序的
WEB-INF/lib/
目录中是有效的

有人知道为什么在部署期间,
my database.jar
my interfaces.jar
库似乎没有添加到类路径中吗?更具体地说,有人知道为什么在部署期间加载
my.server.ControllerOne
类时,
my.interfaces.InterfaceOne
类不可见吗部署

MyServer
web.xml
内容:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>MyServer</display-name>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
    <welcome-file>default.xhtml</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/balusc.taglib.xml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
  </context-param>
  <filter>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>
  <context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
  </context-param>
</web-app>

我的服务器
index.xhtml
default.xhtml
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
状态保存方法:“客户端”或“服务器”(=默认值)。请参阅JSF规范2.5.2
javax.faces.STATE_保存方法
客户
javax.servlet.jsp.jstl.fmt.localizationContext
资源.应用
javax.faces.FACELETS\u库
/WEB-INF/balusc.taglib.xml
javax.faces.explait_EMPTY_STRING_SUBMITTED_VALUES_为_NULL
真的
PrimeFaces文件上载筛选器
org.primefaces.webapp.filter.FileUploadFilter
PrimeFaces文件上载筛选器
Facesservlet
javax.faces.PARTIAL_STATE_保存
假的
MyServer pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.webapp</groupId>
    <artifactId>my-server</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <name>My Server</name>
    <parent>
        <groupId>my.webapp</groupId>
        <artifactId>my-parent-pom</artifactId>
        <version>1.5</version>
    </parent>
    <organization>
        <name>Example</name>
        <url>http://www.example.com</url>
    </organization>
    <repositories>
        <repository>
            <id>eclipselink</id>
            <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>eclipselink</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.3.0</version>
        </dependency>

        <dependency>
            <groupId>utilities</groupId>
            <artifactId>utilities</artifactId>
            <version>0.1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>my.webapp</groupId>
            <artifactId>my-database</artifactId>
            <version>0.1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>3.4.1</version>
        </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.1</version>
    </dependency>
    </dependencies>

    <packaging>war</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <!-- <configuration> section added to pick up the WEB-INF/web.xml inside
                    WebContent -->
                <configuration>
                    <webResources>
                        <resource>
                            <directory>WebContent</directory>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <scm>
        <connection>scm:svn:https://svn.server/location/in/repo/my_server</connection>
        <developerConnection>scm:svn:https://svn.server/location/in/repo/my_server/trunk</developerConnection>
    </scm>
</project>

4.0.0
my.webapp
我的服务器
0.1.0-SNAPSHOT
我的服务器
my.webapp
我的父母是波姆
1.5
例子
http://www.example.com
日食
http://www.eclipse.org/downloads/download.php?r=1&;nf=1&;file=/rt/eclipselink/maven.repo/
爪哇
JavaEEAPI
6.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>my-database</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <parent>
    <groupId>my.webapp</groupId>
    <artifactId>my-parent-pom</artifactId>
    <version>1.5</version>
  </parent>
  <dependencies>
    <dependency>
      <groupId>eclipselink</groupId>
      <artifactId>eclipselink</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mindrot</groupId>
      <artifactId>bcrypt</artifactId>
      <version>0.2.0</version>
    </dependency>
    <dependency>
        <groupId>my.webapp</groupId>
        <artifactId>my-interfaces</artifactId>
        <version>0.1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jpa_3.0_spec</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.0.5</version>
        <scope>test</scope>
    </dependency>
  </dependencies>
  <scm>
    <connection>scm:svn:https://svn.server/location/in/repo/my_database</connection>
    <developerConnection>scm:svn:https://svn.server/location/in/repo/my_database/trunk/</developerConnection>
  </scm>
  <groupId>my.webapp</groupId>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>my.webapp</groupId>
  <artifactId>my-interfaces</artifactId>
  <version>0.1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
  <parent>
      <groupId>my.webapp</groupId>
      <artifactId>my-parent-pom</artifactId>
      <version>1.5</version>

  </parent>
  <scm>
    <connection>scm:svn:https://svn.server/location/in/repo/my_interfaces</connection>
    <developerConnection>scm:svn:https://svn.server/location/in/repo/my_interfaces/trunk</developerConnection>
  </scm>
  <dependencies>
    <dependency>
        <groupId>my.webapp</groupId>
        <artifactId>my-utilities</artifactId>
        <version>0.1.2</version>
        <classifier>me</classifier>
    </dependency>
      <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>6.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
      </dependencies>
</project>