我正在NetBeans8.0 IDE中开发一个java webapplication,apache-tomcat服务器。
我有三个项目,其中一个有父pom.xml,另外两个有自己的pom.xml,这个应用程序有遗留代码,并且在运行时引用了服务器库中的ojdbc6 JAR。现在管理层希望我们将所有依赖项JAR移到WAR的WEB-INF/lib
我们在应用程序的本地文件夹中下载了JAR,但由于某种原因,当我将它们移到pom.xml时,它没有从Web-INF中得到引用,我认为我可能是对group和artifactid的错误。所以我直接从codeIds maven存储库引用它,现在我有两个问题1。只有在使用依赖项2构建时,我才会在Web-Inf中看到这个jar。在Web-Inf中看到它之后,当我调试或运行它时,我会在运行时得到ojdbc-driver异常。
但是当我将相同的jar移动到server/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>portalsGroupId.portals</groupId>
<artifactId>matrix</artifactId>
<name>matrix</name>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<url>http://www.8x8.com</url>
<parent>
<groupId>portalsGroupId</groupId>
<artifactId>portals</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<repositories>
<repository>
<id>codelds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>Jboss Repository for Maven</name>
<url><http://repository.jboss.org/nexus/content/groups /public></url>
</repository>
<repository>
<id>jboss</id>
<name>Jboss</name>
<url>http://repository.jboss.com/maven2/</url>
</repository>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://8x8.com/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.richfaces.bom.version>4.0.0.Final</org.richfaces.bom.version>
<slf4j.version>1.5.6</slf4j.version>
<jsf.version>2.1.2</jsf.version>
<ssputil.version>1.0-SNAPSHOT</ssputil.version>
<sspapi.version>1.0-SNAPSHOT</sspapi.version>
<oltu.version>1.0.0</oltu.version>
</properties>
<build>
<finalName>matrix-${project.version}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/java</directory>
<targetPath>/WEB-INF/src</targetPath>
</resource>
</webResources>
<webResources>
<resource>
<directory>${basedir}/../ext_lib/cloud/</directory>
<targetPath>/WEB-INF/lib</targetPath>
</resource>
<resource>
<directory>${basedir}/../ext_lib/commons-net/</directory>
<targetPath>/WEB-INF/lib</targetPath>
</resource>
<resource>
<directory>${basedir}/src/main/java/com/_8x8/matrix/skin/</directory>
<targetPath>/WEB-INF/classes</targetPath>
</resource>
<resource>
<directory>${basedir}/../ext_lib/httpclient431/</directory>
<targetPath>/WEB-INF/lib</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jee6</id>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jstl*</packagingExcludes>
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jstl*</warSourceExcludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu.version}</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>jee6</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jstl*</packagingExcludes>
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jstl*</warSourceExcludes>
</configuration>
</execution>
</executions>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/java</directory>
<targetPath>/WEB-INF/src</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>matrix_ssp_api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${jsf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.19</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
<type>jar</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<version>${org.richfaces.bom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>${org.richfaces.bom.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.cdk</groupId>
<artifactId>annotations</artifactId>
<scope>provided</scope>
<version>${org.richfaces.bom.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<!--scope>provided</scope-->
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<!-- Local Project Dependency -->
<dependency>
<groupId>portalsGroupId.portals</groupId>
<artifactId>matrix_ssp_util</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com._8x8.matrix</groupId>
<artifactId>matrix_httpClient401_cmncodec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>portalsGroupId.portals</groupId>
<artifactId>matrix_ssp_api</artifactId>
<exclusions>
<exclusion>
<groupId>com._8x8.matrix</groupId>
<artifactId>matrix_httpClient401_cmncodec</artifactId>
</exclusion>
</exclusions>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>portalsGroupId.portals</groupId>
<artifactId>matrix_cloud_commons</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/cloud/cloud_commons.jar</systemPath>
</dependency>
<dependency>
<groupId>portalsGroupId.portals</groupId>
<artifactId>matrix_cloud_client</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/cloud/cloud_client.jar</systemPath>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/commons-net/commons-net-3.0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>sims</groupId>
<artifactId>sims</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/sims/sims-connector.jar</systemPath>
</dependency>
<dependency>
<groupId>jlayer</groupId>
<artifactId>jlayer</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/jlayer/jl1.0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>cdirector</groupId>
<artifactId>cdirector</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/chartdirector/ChartDirector.jar</systemPath>
</dependency>
<dependency>
<groupId>gson</groupId>
<artifactId>gson222</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${project.basedir}/../ext_lib/gson/google-gson-2.2.2/gson-2.2.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
</project>
只是下载一个jar并将其放入项目文件夹并不是“Maven方式”...
如果你想使用一个不在中央回购中的库,你要么把它放在你的本地回购中,要么使用另一个远程回购。如果我没有理解错,您已经选择使用code.lds.org
回购。我在你的pom里看不到的是(真正的)依赖。只有OJDBC6
的依赖关系管理。
您必须将此添加到
部分,并运行MVN Package
(或在Netbeans构建中),并且ojdbc6 jar应该打包到WAR中。
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
(此处跳过版本,因为它已在
中定义;不需要
因为它是默认值...)
您还可以看看这个问题,也许还有更多/其他信息:Oracle JDBC ojdbc6 Jar作为Maven依赖项
我对spring-boot环境有点陌生,并在上面做了一个poc。我知道这听起来可能很奇怪,但我有一个问题,比如是否可以在tomcat服务器中部署spring-boot jar。我之所以这么问,是因为我在某处读到springbootjar将附带嵌入式tomcat,而且.class文件将存储在与普通jar不同的路径中。所以,现在如果我在tomcat服务器中部署这个jar,它是否也能正常工作,或者我们是
我们最近开始为S3和SES使用AWS API,因此我们根据文档的要求将其添加到我们的依赖项中: 但我们的WAR文件从仅66Mb增长到了近150Mb。有没有办法减少亚马逊代码的开销,因为它一直充斥着我们的Perm Gen和OOM。我暂时增加了Perm Gen,但如果我可以删除不必要的代码,我可能会再次降低Perm Gen。 有没有官方的方法来减少依赖关系?
我有两个服务器,我可以从我的服务器的jsp调用另一个服务器的jsp。 就像下面的代码一样。首先是服务器JSP。 当我点击提交时,控件将进入第二个服务器,它将以name作为参数,并将其放入我的第二个服务器的jsp中。 第二服务器JSP. 我想使用Servlet做完全相同的事情。 我试图与Servlet的重定向我的控制将去第二服务器,但因为重定向它不会采取"名称"peramater。 我尝试使用For
当我导出到JAR时,嵌入式Derby服务器的Spring Boot无法工作。但当我在eclipse中运行该应用程序时,它可以正常工作。它只是当我导出它到jar时,当它不工作。 下面是我的POM https://maven.apache.org/xsd/maven-4.0.0.xsd“>4.0.0 org.springframework.boot spring-boot-starter-parent
我试图在AWS EC2实例上运行我的java Web应用程序。我得到的错误是 通过查看其他问题,我发现问题可能与MANIFEST.mf文件有关。我把那个文件放在META-INF文件夹下,但是它缺少主类标记。 我使用servlet之类的东西开发了Java web应用程序,但我没有使用SpringBoot,我不确定我的程序的起点是什么。 以下是我的pom.xml的一部分: 我原以为maven jar插
` ` 在TOmCAT服务器中。我无法运行这个项目。? ` 严重:web应用程序[/SpringMvc4]中的Servlet[spring]抛出了load()异常Java。伊奥。FileNotFoundException:无法打开组织上的ServletContext资源[/WEB-INF/spring servlet.xml]。springframework。网状物上下文支持ServletCont