简体   繁体   English

将maven创建的war文件部署到glassfish服务器,确定类路径的顺序?

[英]Deploying a war file created by maven to a glassfish server, determine the order of the classpath?

Setup 设定

I have a maven project which creates a war file, I then deploy the war file to a glassfish server (3.1). 我有一个maven项目,该项目创建一个war文件,然后将war文件部署到glassfish服务器(3.1)。

My Manifest is default one with just the basic info, but I've also tried maven-war-plugin to add classpath to the Manifest. 我的清单是默认的,只包含基本信息,但我也尝试过使用maven-war-plugin将类路径添加到清单中。 From my understanding of that plugin it should only help me determine libs outside my web-inf/lib scope. 根据我对该插件的了解,它仅应帮助我确定Web-inf / lib范围之外的库。

Problem 问题

In my war file I have two dependencies which both contain the same class but two different version of that class, so I need to specify my Glassfish Archive class loader to load them in a certain order. 在我的war文件中,我有两个依赖项,它们都包含相同的类,但是该类具有两个不同的版本,因此我需要指定我的Glassfish Archive类加载器以按特定顺序加载它们。 Now I'm completely lost as how to do this, which leads me to my questions. 现在我完全不知道该怎么做,这使我想到了问题。

Questions 问题

  1. Is it possible to use the Manifest file to force Glassfish to use a specific classpath? 是否可以使用清单文件来强制Glassfish使用特定的类路径?
  2. How does Glassfish determine in which order it loads the jar files in WEB-INF/lib? Glassfish如何确定将JAR文件加载到WEB-INF / lib中的顺序?
  3. Is it possible to tell Glassfish how to specify the classpath in some other way? 是否可以告诉Glassfish如何以其他方式指定类路径?
  4. If not, is it possible to affect the order Glassfish loads the jar files in WEB-INF/lib? 如果不是,是否有可能影响Glassfish将jar文件加载到WEB-INF / lib中的顺序?

(I don't have privileges to comment in SO, hence the answer) The following link describes one way of managing the order of class loading.However, as others have rightly pointed out, what you are trying to achieve is not good at all. (我没有特权在SO中发表评论,因此给出了答案)以下链接描述了一种管理类加载顺序的方法。但是,正如其他人正确指出的那样,您试图实现的目标一点都不好。

https://www.java.net/node/704037 https://www.java.net/node/704037

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Glassfish 4 或 5 中部署战争文件时出现异常 - Getting Exception while deploying war file in Glassfish 4 or 5 自动部署War文件的Glassfish 4部署顺序 - Glassfish 4 deployment order for auto deploying war-files Spring Maven War项目未部署到Tomcat服务器 - Spring Maven War Project Not Deploying to Tomcat Server 部署使用Jersey API创建的War文件 - Deploying war file created using jersey api 部署战争后在Glassfish上出现NoClassDefFoundError - NoClassDefFoundError on Glassfish after deploying war 在GlassFish 4服务器上部署War文件时出错(cvc-complex-type.2.4.a:发现无效的内容以元素“ init-param”开头) - Error when deploying war file on GlassFish 4 server (cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param') maven包阶段创建的war文件和maven war plugin war:war目标创建的war文件之间有什么区别吗? - Is there any difference between war file created by maven package phase and war file created by maven war plugin war:war goal 从 maven 部署 WAR - Deploying WAR from maven 使用Maven和classpath intellij中的库创建war文件 - Create war file using maven with libraries from classpath intellij 登录到服务器登录以部署War文件 - Logging to server log on deploying a war file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM