简体   繁体   English

如何在WebSphere中的另一个WLD中公开TLD文件引用的一个类中的类

[英]How do I expose a class from one WAR being referenced by TLD file in another in WebSphere

When I run WebSphere locally, I am getting "Failed to open resource" warnings because an entry in my app.tld file is referencing a base class in another WAR in the same EAR. 在本地运行WebSphere时,出现“无法打开资源”警告,因为app.tld文件中的条目引用了同一EAR中另一个WAR中的基类。

I don't have control over deployment, so jar'ing up these class files isn't a good solution for me. 我无法控制部署,因此对这些类文件进行罐装对我来说不是一个好的解决方案。 The only other feasible solution I can come up with is creating a subclass in my WAR, but due to our source control, I would have to check out all the subclasses manually when the base class changes. 我能想到的唯一可行的解​​决方案是在WAR中创建一个子类,但是由于我们的源代码控制,当基类发生更改时,我将不得不手动检出所有子类。

I tried playing with classloader settings with no luck as well. 我也尝试使用classloader设置,但也没有运气。 Any suggestions/best practices on how to handle this situation? 有关如何处理这种情况的任何建议/最佳做法?

The best practice is to put shared classes in a JAR in the lib directory of the EAR. 最佳实践是将共享类放在EAR的lib目录中的JAR中。 The next best option would be to copy the JAR into both WARs. 下一个最佳选择是将JAR复制到两个WAR中。 The final option I would consider is to change the application class loader policy to be "Application" rather than the default "Module" so that all WARs are loaded using the same class loader. 我会考虑的最后一个选择是将应用程序类加载器策略更改为“ Application”,而不是默认的“ Module”,以便所有WAR都使用相同的类加载器加载。 See the Class loaders topic in the Knowledge Center for more information. 有关更多信息,请参见知识中心中的类加载器主题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM