WebLogic Classpath does not append the classpath options under server start - weblogic

When I add some new directories, jars etc to the WebLogic classpath under Server Start, it somehow does not append these values to the existing classpath. It just replaces the existing classpath with what I have provided in ClassPath under Server Start.
To get around this problem, I need to put the existing classpath under Server start and then add the additional classpath directories.
Is there a way to tell WebLogic to consider the values specified under ClassPath to be treated as additions to the already existing classpath?

Related

How do you change the class path to a jar file on intellij idea?

How do you change the classpath to a jar file or a different directory?
Go to File-> Project Structure-> Libraries and click green "+" to add the directory folder that has the JARs to CLASSPATH. Everything in that folder will be added to CLASSPATH. Update: It's 2018. It's a better idea to use a dependency manager like Maven and externalize your dependencies. Don't add JAR files to your project in a /lib folder anymore.
I am attempting to add an external jar to my module's build path. I've added the jar as a module dependency and as a library, and the compiler is still unable to find the jar. I'm using intelliJ 14.1. I have verified that the jar is intact and not corrupt.
JAR manifest: IntelliJ IDEA will pass a long classpath via a temporary classpath.jar. The original classpath is defined in the manifest file as a class-path attribute in classpath.jar . You will be able to preview the full command line if it was shortened using this method, not just the classpath of the temporary classpath.jar .

Setting X Frame Options on Weblogic

I need to configure X- Frame Options for my Angular.js Application which runs on Weblogic Server but I can,t seem to find an example. My preference would be to do it in web.xml file similar to this example for Tomcat :
How do I set X-Frame-Options as response header in angularJS?
We also faced the same issue. One of the approach is suggested by 'user1107888'. You don't have to create another project explicitly
the other approach is,
Update the web.xml with the filter details.
Add the tomcat and its dependent jars as a part of the external jars OR add it to the build script of the war file (if you are not using maven or gradle) OR directly add it to the classpath of weblogic classpath.
In case you are using maven/gradle for your build, add them as dependency.
Hope this helps.

weblogic ear external jar dependency

We have a weblogic ear which has dependency with a third party jar. We don't want to keep this jar inside of the ear. Is there any other better way or better place to keep this jar and load it only at the ear class loader.
I personally would package the third party jar into the ear. You have a couple of other options...
Add the jar file into your weblogic domain lib directory, this will put it on the classpath for every server:
<domain folder> -> lib
A better way would be to edit your server classpath to also include the third party jar. Login to your admin console and edit:
Servers -> server_name -> Server Start tab -> Classpath
Keep in mind this will put the jar on the classpath for all apps running on that particular server. If that is not desirable you can look into preferring the jar(s) in your ear file over those on the classpath like:
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.xml.sax.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>

Dynamically loading dependency in maven

Can we dynamically load dependencies using maven.
For example, lets say we have a web project which needs a specific jar A to run on Glassfish server, while the same project needs additional jar B to run on weblogic in its WEB-INF/lib folder.
Do I need to have the separate pom.xml file for glassfish and weblogic and then run the appropriate pom.xml depending on the server being used?
Or Can I have a single pom.xml with both dependencies i.e. both jar A and jar B specified in it and depending on the parameters passed to pom.xml while running it (like mvn clean package -Dserver=glassfish), it will load the jar A only?
Is this possible?
What is the most appropriate way of doing this?
Please help.
You can exploit the concept of profiles in maven. You can create a whole profile of your execution environment and launch maven with that profile. For more info, see http://maven.apache.org/guides/introduction/introduction-to-profiles.html
These profiles can be defined within pom or can be defined in an external file and refer it to in pom. You can activate a profile by launching it with -P option, mvn -P

Maven2 + JMeter + JUnit with dependencies

I'd like to run my JUnit tests in JMeter. Using maven-jar-plugin I can create a jar with my tests in order to put it inside the JMeter's classpath ($JMETER_HOME/lib/junit). The problem is that my tests have a lot of dependencies that Maven2 doesn't put into the jar, including the main classes of the project, classes from other projects and external libraries. How can I do this?
You can use the fatjar plugin.
As iwein has mentioned, you may use the maven-fatjar-plugin which will put all the dependent JAR's inside of your JAR artifact and create the appropriate MANIFEST entries to include them on your classpath.
Another option is that you can use the maven-shade-plugin which will simply take all of the ".class" files out of the dependecy JARs and include them directly in your JAR. This is called a UBER-JAR. There are a couple of reasons which I prefer this approach:
This often leads to slightly smaller JARs
I have other plugins which already manipulate the MANIFEST (including the Classpath property) and I don't want to chance having an incorrect manifest being generated.
Creating an UBER-JAR is just too good to pass up ;)