Reputation: 949
I am trying to put a message in JMS queue in WebLogic server. My application is running in Wildfly 8 AS. I have written the code for the JNDI lookup and then putting message in JMS queue. I am using the following code for initializing the InitialContext:
private static InitialContext getInitialContext(String url) throws NamingException {
Hashtable<String, String> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
env.put(Context.PROVIDER_URL, url);
return new InitialContext(env);
}
I have added the following Maven dependencies for adding the WebLogic jar
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>12.2.1</version>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>webservices</artifactId>
<version>12.2.1</version>
</dependency>
But the maven dependencies are not getting resolved. Do I need to add any maven repository?
If anything else is required, can anyone please guide me on that?
Regards, Anirban.
Upvotes: 1
Views: 2856
Reputation: 65
The Checked answer is actually wrong, although it may have been correct at the time of writing.
You can do the same thing as including weblogic.jar
(which is just a meta-inf with a bunch of classpath entries) in maven by including
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-server-pom</artifactId>
<version>12.2.1-4-0</version>
<type>pom</type>
</dependency>
in your maven POM - of course, replacing the version with the version you have in your .m2
folder. (if you have none, nothing will work and youll have to look up in the weblogic docs how to install weblogic maven artifacts into your local maven repo for your version of weblogic)
This essentially is a dependency listing to mirror weblogic.jar
It doesnt work for every situation, as some instances (usually instances requiring the use of wlManagementMBean.jar
) of use require the use of a hardcoded weblogic installation paths (for that you have to add weblogic.jar to the classpath directly)
But it should work with projects utilizing Weblogic JNDI lookups and JMS server apis, among other things
Please note: your first run with maven will take a few minutes, as maven automatically tries to check maven central for artifact updates, regardless of local installation
Upvotes: 0
Reputation: 1377
Weblogic does not provide client jar artifact in maven repository. You must get the wlthint3client.jar
located in the WL_HOME\server\lib
directory of your weblogic server. This jar contains all classes needed by clients calling the weblogic server.
Then you can install it manually in your maven repository and use it as a maven dependency in your pom.xml
Finally, you can lookup the InitialContext
using the weblogic.jndi.WLInitialContextFactory
factory.
Upvotes: 4