Liberty不会加载共享库jar

时间:2016-12-23 21:12:15

标签: websphere-liberty

我有使用Spring的Spring MVC应用程序4.我在Liberty 16.0.0.3中部署我的应用程序。我有以下server.xml配置。

<server description="Default Server">
        <featureManager>
            <feature>webProfile-7.0</feature>
                <feature>localConnector-1.0</feature>
            </featureManager>


        <variable name="defaultHostName" value="localhost"/>

           <keyStore id="defaultKeyStore" password="mypassword" />

            <!-- Define an Administrator and non-Administrator -->
           <basicRegistry id="basic">
              <user name="admin" password="mypassword"/>
              <user name="nonadmin" password="mypassword"/>
           </basicRegistry>

           <!-- Assign 'admin' to Administrator -->
           <administrator-role>
              <user>admin</user>
           </administrator-role>

           <webContainer deferServletLoad="false"/>
           <applicationManager autoExpand="true"/>

            <httpEndpoint host="*" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
           <variable name="defaultHostName" value="localhost"/>

        <library id="global">
                <fileset dir="${shared.config.dir}/lib/global" includes="*.jar" />
            </library>

            <application type="war" location="testliberty.war" autoStart="true" context-root="/Spring4">
                <classloader  commonLibraryRef="global" delegation="parentLast"/>
            </application>
</server>

我已将所有弹簧特定的罐子放在下面的位置。 USR \共享\ CONFIG \ LIB \全球 Anthoer选项 服务器\ lib中\全球

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
    <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>com.liberty.sample</groupId>
        <artifactId>TestLiberty</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <packaging>war</packaging>

        <name>HelloWorld</name>
        <description>Demo project for Spring Boot</description>

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
            <org.springframework-version>4.3.0.RELEASE</org.springframework-version>
            <runtime.scope>provided</runtime.scope>
        </properties>

        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${org.springframework-version}</version>
                <scope>${runtime.scope}</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.0.1</version>
                <scope>${runtime.scope}</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
                <scope>${runtime.scope}</scope>
            </dependency>
        </dependencies>

        <build>
            <finalName>HelloWorld</finalName>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
                        <configuration>
                            <source>${java-version}</source>
                            <target>${java-version}</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.4</version>
                        <configuration>
                            <warSourceDirectory>src/main/webapp</warSourceDirectory>
                            <warName>testliberty</warName>
                            <failOnMissingWebXml>false</failOnMissingWebXml>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>


</project>

但是这个选项都没有工作。由于Spring应用程序上下文没有被加载,因此没有加载这些jar。但是如果我将所有jar包装在WEB-INF / lib文件夹中,那么同样的应用程序工作正常。

0 个答案:

没有答案