Weblogic JMS binding issue, class could not be initialized exception - jms

Could not initialize class exception is coming when trying to view the jndi bindings for a JMS destination in Weblogic 12c server. I have setup JMS modules with JMS destination queues and connection factory. Below are the things that is deployed in the server :
JMS Module : MyAppJmsModule (JMSSystemResource)
JMS Server : MyAppJMSServer (Foreign Server)
JNDI Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL: file:///abc/oracle/config/domains/domain_test/jms/MyAppJmsModule/MyAppJMSServer/jms
In the above path lies the .bindings file
Destination tab showing Name, Local JNDI name and Remote JNDI name correctly.
Connection Factories tab also showing the jndi names correctly.
Local jndi name is prefixed with jms/
Now when I am clicking on the destination inside the JNDI Tree, it gives me the below error:
Unexpected exception: failed to load return type: class java.lang.Object; nested exception is: java.lang.ClassNotFoundException: Failed to load class com.ibm.mq.jms.MQQueue
Error from weblogic log :
An error was generated by the RMI server:
weblogic.jndi.internal.RootNamingNode.lookup(Ljava.lang.String;Ljava.util.Hashtable;)
java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.jms.MQXAQueueConnectionFactory.
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory.class$(MQXAQueueConnectionFactoryFactory.java:58)
at com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory.getObjectInstance(MQXAQueueConnectionFactoryFactory.java:58)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
Successful JNDI binding should show something like this :
Binding Name: jms.QUEUENAME
Class: com.ibm.mq.jms.MQQueue
Hash Code: Some Value
toString Results: queue://QUEUEMGR/APP.QUEUENAME?persistence=2&expiry=0
I have deployed an appplication which got deployed successfully but in warning state. When I checked the monitoring tab for the application it is showing the below error :
Symtom{MDB,MEDIUM,MyApp-0.0.1-SNAPSHOT,MDB application MyApp-0.0.1-SNAPSHOT is NOT connected to messaging system.}
I have checked few of the classes that got loaded and I found the below relevant classes that is being displayed in application classpath :
~/application/config/com.ibm.mq-9.0.0.jar
~/application/config/com.ibm.mq.headers.jar
~/application/config/com.ibm.mq.jmqi-9.0.0.jar
~/application/config/com.ibm.mq.pcf-6.1.jar
~/application/config/com.ibm.mqjms-9.0.0.jar
~/application/config/commons-codec-1.10.jar
~/application/config/dhbcore.jar
~/application/config/fscontext.jar
~/application/config/javaee-api-5.jar
~/application/config/jms.jar
~/application/config/jndi.jar
~/application/config/providerutil.jar
Please help me to find out what is I am missing in my configurations.

The application got successfully deployed and it is connecting to the JMS messaging system. I have removed javaee-api jar as it was already there in the classpath with a different version and added the jms-api jar from weblogic library.
However, the destination in the JNDI tree is still giving the error.

Related

Call EJB from another domain

What I am doing:
I'm trying to develop a small prog for calling the EJB from another domain.
Version
EJB 3.0
Weblogic 10.3.6
There are 2 domains on Machine1 and Machine2 so the managed servers are
domain1_cluster1_machine1 domain1_cluster1_machine2
domain2_cluster1_machine1 domain2_cluster1_machine2
(hope that I make it clear)
I followed this blog to develop the prog:
http://edwin.baculsoft.com/tag/weblogic/
I deployed the EJB on domain1_cluster1_machine1 and domain1_cluster1_machine2 with Active status and it can be found in JNDI tree.Then the client application is deployed on domain2_cluster1_machine1 and domain2_cluster1_machine2
All of the code is same as the blog, besides the provider url:
t3://[IP of Machine1]:[Listen port of domain**1**_cluster1_machine1]
When I run the client application from domain2_cluster1_machine1, I got the following exception:
javax.naming.CommunicationException [Root exception is
java.rmi.UnmarshalException: failed to unmarshal class
java.lang.Object; nested exception is:
java.lang.ClassNotFoundException: com.edw.ejb3.HelloEJBRemote]
When I type wrong in the lookup ie ic.lookup("com.edw.ejb3.HelloEJBRemote"), the exception is:
javax.naming.NameNotFoundException: While trying to lookup
'com.edw.ejb3.HelloEJBRemote' didn't find subcontext 'com'. Resolved
'' [Root exception is javax.naming.NameNotFoundException: While trying
to lookup 'com.edw.ejb3.HelloEJBRemote' didn't find subcontext 'com'.
Resolved '']; remaining name 'com/edw/ejb3/HelloEJBRemote'
Therefore, can I conclude that the client is able to find the EJB from domain1 as the exception is not NameNotFoundException?
Then what's wrong this it? Is it related to security?
I am newbie of both Weblogic and EJB. Your help will be appreciated. Thank you!
As mentioned in the comments, Please make sure that you have deployed the EJBs like described below -
Cluster 1
HelloEJBRemote
HelloEJBRemoteImpl
Cluster 2
HelloEJBRemote
Do a look up from Cluster2 to Cluster 1 for the Bean using the JNDI name of HelloEJBRemoteImpl

How to configure Wildfly JMS connection factory and destination

I have migrated recently from Glassfish 4 to Wildfly 8.1
I have configured JMS Connection Factory and Destination in Glassfish as:
connection factory------------------------------
jndi name: emailConnectionFactory
resource type: javax.jms.QueueConnectionFactory
destination ------------------------------------
jndi name: emailQueue
resource type: javax.jms.Queue
In Wildfly I go to Configuration->Messaging->Destinations->Connection Factories and enter values name and jndi name as above. but it tells me that jndi name must start from 'java:/' or 'java:jboss/'.
I tried to use jndi name as 'java:/ConnectionFactory' and destination and in Configuration->Messaging->Destinations->queue/topics jndi name as 'java:/jms/queue/emailQueue'
but it didnt gave me and exception and didnt send email with previous email setting
Do the same configuration in standalone-full.xml file .
link1
link2
cool. our team is also doing the same thing - migrating a huge glassfish4 app to wildfly.
Keep this in mind,
For connection factory must be prefixed with java:/ or
java:jboss/exported/ (for remote access).
For queues and topics, use the same rule. Any jms-queue or jms-topic which needs to be
accessed by a remote client needs to have an entry in the
"java:jboss/exported" namespace.

Add authoraization in Jmeter load testing with JMeter jms point to point queue

I am using jmeter jms point to point queue for load testing.
But I am getting the following error:
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed]
I am using jmeter 2.11 version
I add user name and password in jndi properties. But still it is not working. Here is the configuration i am using:
QueueConnectionFactory: RemoteConnectionFactory
initial context factory: org.jboss.naming.remote.client.InitialContextFactory
url : remote://localhost:4447
JNDI Prpperties:
username: ..............
password: ...........
Your Jndi properties seem wrong, check this:
http://docs.oracle.com/cd/E19182-01/820-7853/ghyco/index.html
Login / password props are :
java.naming.security.principal
The identity of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_PRINCIPAL.
java.naming.security.credentials
The credentials of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_CREDENTIALS.
I have encountered similar problem while using jmeter for solace, hope this help to someone having similar issue.
For solace jms testing need to use jndi properties since there is no place holder for VPN name. JNDI properties file will look something like this:
java.naming.factory.initial=com.solacesystems.jndi.SolJNDIInitialContextFactory
java.naming.provider.url=<IP:port><br>
Solace_JMS_VPN=<VPN Name><br>
java.naming.security.principal=<username><br>
java.naming.security.credentials=<password>
Here the jndi properties has to be packaged as a jar file and placed in the jmeter lib folder in order to be picked at runtime.
jar cvf my-jndi-properties.jar jndi.properties
Hope this helps.

Websphere, Spring WS A resource reference binding could not be found

I am trying to deploy Spring web application using Spring Web Services on Websphere 8. Deploy to Tomcat works without any problem but with Websphere I needed to add jaxws-rt (this wasn't needed for Tomcat, but also with it is working) and after that I am still getting on WAS:
CWNEN0044E: A resource reference binding could not be found for the following resource
references [com.sun.xml.ws.transport.tcp.servicechannel.ServiceChannelWSImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.coord.RegistrationRequesterPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.coord.RegistrationPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.coord.ActivationRequesterPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.coord.RegistrationCoordinatorPortTypeImpl/wsContext,
com.sun.xml.ws.mex.server.MEXEndpoint/wsContext,
com.sun.xml.ws.tx.webservice.member.at.CoordinatorPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.coord.ActivationCoordinatorPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.at.CompletionInitiatorPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.at.ParticipantPortTypeImpl/wsContext,
com.sun.xml.ws.tx.webservice.member.at.CompletionCoordinatorPortTypeImpl/wsContext]
How to specify reference bindings?
I also see another error during deployin SystemErr:
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load
webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider
com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer not a subtype
But I am not sure if this is somehow connected with reference binding problem.

How to test WSO2 Message Broker with JMeter

I'm having some issues getting JMeter to work against the WSO2 Message Broker using the JMS Publisher. I had JMeter working against ActiveMQ but I'm still new with the tool.
I copied the client libraries over to jmeter wso2mb-2.0.1\client-lib to apache-jmeter-2.9\lib
andes-client-0.13.wso2v4.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
Settings:
Context Factory : org.wso2.andes.jndi.PropertiesFileInitialContextFactory
Provider Url : amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5672'
Connection Factory : qpidConnectionfactory
...also tried several other values
Destination: dynamicQueues/test
The error I'm getting is on the Connection Factory field.
I've tried several different values all of which generate a naming error like there is a setting missing.
When I leave it blank I get:
javax.naming.NamingException: Expected javax.jms.ConnectionFactory, found org.wso2.andes.jndi.ReadOnlyContext
Does anyone know what I'm missing here?
Suspect it's something simple.
I found the problem.
In short the qpid context factory org.wso2.andes.jndi.PropertiesFileInitialContextFactory does not use fields the same way as the activeMQ context factory org.apache.activemq.jndi.ActiveMQInitialContextFactory.
While ActiveMQ allows you to not use a separate properties file with Jmeter, Qpid does not.
Jmeter JMS Publisher:
Context Factory : org.wso2.andes.jndi.PropertiesFileInitialContextFactory
Provider Url : nameOfYouFile.properties
Connection Factory : qpidConnectionfactory
Destination : <QueuePropertyName>
nameOfYouFile.properties:
connectionfactory.qpidConnectionfactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5672'
queue.JMeterQueue = JMeterQueue
Reference:
Qpid Wiki

Resources