我是Spring MVC的新手。我试图将我的核心Maven项目添加到Spring MVC Maven项目中。它构建成功,我可以在“ target \ project.war \ WEB-INF \ lib”中看到相应的jar文件,但在glassfish控制台上会引发错误。
信息:访问未访问的参考信息信息:访问未访问的信息 引用严重:部署应用程序时发生异常[IDSNGWeb] 严重:生命周期处理期间发生异常 java.lang.NullPointerException在 com.sun.enterprise.deployment.EnvironmentProperty.isConflictResourceGroup(EnvironmentProperty.java:433) 在 com.sun.enterprise.deployment.ServiceReferenceDescriptor.isConflict(ServiceReferenceDescriptor.java:699) 在 org.glassfish.web.deployment.descriptor.WebFragmentDescriptor.combineServiceReferenceDescriptors(WebFragmentDescriptor.java:210) 在 org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl.addJndiNameEnvironment(WebBundleDescriptorImpl.java:277) 在 org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl.addCommonWebBundleDescriptor(WebBundleDescriptorImpl.java:268) 在 org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl.addWebBundleDescriptor(WebBundleDescriptorImpl.java:156) 在 org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:354) 在 org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:91) 在 com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:421) 在 com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396) 在 com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271) 在 com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280) 在 com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241) 在 com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161) 在 org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:203) 在 org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227) 在 org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96) 在 com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881) 在 com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:821) 在 com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:377) 在 com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 在 org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ 2 $ 1.run(CommandRunnerImpl.java:539) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ 2 $ 1.run(CommandRunnerImpl.java:535) 在java.security.AccessController.doPrivileged(本机方法)在 javax.security.auth.Subject.doAs(Subject.java:360)在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ 2.execute(CommandRunnerImpl.java:534) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ 3.run(CommandRunnerImpl.java:565) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ 3.run(CommandRunnerImpl.java:557) 在java.security.AccessController.doPrivileged(本机方法)在 javax.security.auth.Subject.doAs(Subject.java:360)在 com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl.access $ 1300(CommandRunnerImpl.java:109) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ ExecutionContext.execute(CommandRunnerImpl.java:1846) 在 com.sun.enterprise.v3.admin.CommandRunnerImpl $ ExecutionContext.execute(CommandRunnerImpl.java:1722) 在 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 在 com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 在 org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 在 com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallable.call(ContainerMapper.java:459) 在 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 在 org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) 在 org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) 在 org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 在 org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) 在 org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) 在 org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 在 org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) 在 org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access $ 100(WorkerThreadIOStrategy.java:56) 在 org.glassfish.grizzly.strategies.WorkerThreadIOStrategy $ WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 在 org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:591) 在 org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:571) 在java.lang.Thread.run(Thread.java:748)
严重:部署应用程序时发生异常
我无法添加任何Maven项目或jar文件。我很有可能在添加依赖项方面做得不好。如果有人可以帮助我。提前致谢。
下面是我的POM文件。
http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0
<groupId>com.agnisys.idsng</groupId>
<artifactId>IDSNGWeb</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>IDSNGWeb</name>
<properties>
<endorsed.directory>${project.build.directory}/endorsed</endorsed.directory>
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<spring.version>3.2.13.RELEASE</spring.version>
<!-- <property name="AS_HOME" value="C:\Users\Agnisys56\Documents\GitHub\IDS-NextGen\IDSNGWeb\src\main\webapp"/> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.agnisys</groupId>
<artifactId>IDSManager</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.directory}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.directory}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:0)
我以前使用过的一种方法是创建一个包含两个项目的主项目,该主项目应具有主POM文件,该文件在所有子项目之间具有共享的依赖关系,并且每个项目都应具有自己的POM配置。然后,您可以在春季MVC项目POM中导入第二个子项目。 更多详细信息:
https://howtodoinjava.com/maven/maven-parent-child-pom-example/
您还可以使用称为“多模块项目”的东西:
https://www.baeldung.com/maven-multi-module
https://www.mkyong.com/maven/maven-how-to-create-a-multi-module-project/