I am trying to use a new version of ehcache in my EAR file but there is an older one in the domain/lib folder of the weblogic server.
Of course it's not possible to upgrade the one in the domain/lib folder because it's used in other EAR files.
Is there a way to use the one inside my EAR file.
I tried to use :
<prefer-application-packages>
And
<prefer-application-resources>
In the weblogic-application.xml without success. It seems that the jar used is the one in the domain/lib folder.
I am trying to use ehcache with spring and I am using spring within a library deployed in weblogic.
Right now we are using WEBLOGIC 10 and we will use WEBLOGIC 12 in a few weeks.
Any ideas to solve this?
In my case it was not working because I used Spring from a library deployed in my weblogic.
So Spring was not able to use the Ehcache JAR in my EAR because Spring was not in my EAR. I removed the use of this Spring library and included all the Spring JARs in my EAR to make it work.
Related
I have an application that uses Java 8 + Spring Boot + Spring 5. I packaged this application in War and I can implement it in Tomcat 8.5+ successfully.
Obviously, when I put the same WAR in WAS, it fails. This inherits the JEE context and the libraries get into conflict.
Can I add some kind of descriptor to ignore the capabilities of JEE in my WAR? I want to use WebSphere like a Tomcat.
Finally, I could run my WAR in WAS successfully. I had to downgrade Spring Boot version to 1.5.x because Spring 5 is not complaint with JEE 6.
Please check WebSphere's classloader configuration. Maybe you can make it to load your librares earlier.
https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/crun_classload.html
I'm aware that this is a very simple issue, but as I'm new to Wildfly I haven't had success trying to accomplish it.
In the old days of JBoss 4.2, when I wanted to share an ejb jar file with multiple war files I just deployed the ejb jar file to the application server and configured jndi in my war projects with a file 'jndi.properties' placed in some source directory in the war files, like this:
jndi.properties
---------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099
Now, with Wildfly 8.1, this approach is not working anymore. I don't know if the contents of the jndi properties file changed or if I have to do something else. So, I ask: how do I share an ejb jar file with multiple wars in Wildfly 8.1 (I don't want to use ear files for this)?
Thank you in advance.
Marcos
PS.: Cross-posted: https://developer.jboss.org/thread/249133
just deploy the jar file and add adependency to your war file (either in Manifest.MF or in jboss-deployment-structure.xml from your war to your jar. Then you should be able to do JNDI-lookups using java:global/... or using CDI for injecting the beans using #Inject (for this approach you will need to activate CDI using beans.xml)
see also:
Wildfly class loading
Wildfly deployment descriptors
CDI reference
Application deployment
I use JBoss 5.1 and I deploy an ear on it.
In my ear, few webapps are using some jars which are using by JBoss to.
For example, jboss use slf4j in version 1.5.6 and my webapps uses version 1.7.1
This two versions of slf4j are not compatible (see Logging framework incompatibility).
Is there any way to say to JBoss to use his own lib but webapp have to use theirs ?
Edit : I don't want to change the version of JBoss I use.
Thanks for help !
Create jboss-deployment-structure.xml file in WEB-INF folder with deployment exclusions of jars which you want to attach.
How do I disable app server embedded library(jar) for a particular WAR or EAR?
So I am working on a project whereby we needed to create a custom Tomcat Realm implementation to read authentication credentials from a mongo backed datastore.
This has been pretty painless, but the implementation we have come up with has several dependencies on external libs i.e. scala libs, the java mongo-db driver, spring, salat (a mongodb ORM) etc....
Now in order for Tomcat to use this Realm we must deploy our Jar (and all the dependent jars) to tomcats lib folder.
Being pretty new to Java, I have no idea how much of an issue this is, but it doesn't seem nice to me. So really, my question is what issues would I have with dumping a load of JARs into Tomcats lib directory?
Cheers, Chris.
Most likely dependencies will become a problem. All JARs you place in tomcat/lib are visible to the WARs you deploy at a later time. I suppose your Realm implementation is the base for one or more web applications.
Let's say your Realm depends on Spring 2.0 and you're required to place those libs in tomcat/lib and afterwords you deploy a WAR using Spring 3.0. The WAR will see all classes available in tomcat/lib - the Spring 2.0 classes. So your WAR ships the 3.0 classes in WEB-INF/lib, at runtime it can see the Spring 2.0 libs in tomcat/lib as well as its own Spring 3.0 libs in WEB-INF lib. This is going to cause trouble...
I'm not aware of a simple solution for this, maybe you should have a look at OSGI and Tomcat integration. No question, it won't make life easier...
How does WebLogic 11g load libraries in an EAR file? I have this problem with a web application, that when deployed as a WAR (with libraries it depends on in WEB-INF/lib), it works just fine. However, when it's inside an EAR file, WebLogic does not find those libraries unless I put them in APP-INF/lib. Does that mean that if I'm deploying as an EAR I'd have to pull out all JAR files from the WEB-INF/lib directory and place them in APP-INF/lib ? or is there a configuration that can be done in WebLogic to avoid this?
Thanks!
If you have JAR files that you need to share between multiple WAR files or between WAR files and EAR files then you will need to package them in the EAR.
If WAR#1 has a JAR in its WEB-INF/lib and is packaged in an EAR with WAR#2, then WAR#2 will not be able to see the JAR files in WAR#1/WEB-INF/lib.
Solving your problem will take some understanding of how Java EE classloading works in a container. You should look at this link to get an understanding, but the basic problem is that when you package your application as an EAR, you've introduced another classloader (the application classloader) into the class loading hierarchy. You can configure WebLogic to load from your webapp by using the prefer-web-inf-classes element.