Connecting a remote JMS client to GlassFish 3 - glassfish

I am trying to connect to GlassFish 3's JMS service from a standalone remote client. However I am getting a java.lang.ClassNotFoundException: com.sun.messaging.jms.ra.ResourceAdapter. Any ideas on how to fix this?
Here's my setup so far:
Glassfish 3 JMS Service in LOCAL mode (I am assuming that EMBEDED mode will not work in this case because it bypasses the network stack)
JNDI properties are specified as follows:
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
gf-client-module.jar (in GLASSFISH_HOME/modules) added to the standalone application's classpath. Also tried adding other jars present in the modules directory (such as jms-core.jar), but still getting the same ClassNotFoundException.
Any help would be much appreciated.

Instead of using all of the individual Glassfish jar files that you might need (such as gf-client-module.jar, imqjmsra.jar, and imqbroker.jar), the preferred method is to use the gf-client.jar file. It can be found at $GLASSFISH_HOME/lib.
There is more information at http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB. That document pertains to using EJBs in standalone clients, but the solution is the same for using JMS.

Ok. I found a solution. See here for details, but the short answer is that I needed to add two jars to the classpath: imqjmsra.jar and imqbroker.jar. These were available inside a rar called imqjmsra.rar which can be found under glassfish's mq directory. I had to extract the two jars from this rar!

This is the complete list of client jars for glassfish 3 :
auto-depends.jar
deployment-common.jar
glassfish-corba-internal-api.jar
internal-api.jar
management-api.jar
bean-validator.jar
dol.jar
glassfish-corba-newtimer.jar
javax.ejb.jar
orb-connector.jar
common-util.jar
ejb-container.jar
glassfish-corba-omgapi.jar
javax.jms.jar
orb-iiop.jar
config-api.jar
ejb.security.jar
glassfish-corba-orb.jar
javax.resource.jar
security.jar
config-types.jar
glassfish-api.jar
glassfish-corba-orbgeneric.jar
javax.servlet.jar
ssl-impl.jar
config.jar
glassfish-corba-asm.jar
glassfish-naming.jar
javax.transaction.jar
transaction-internal-api.jar
connectors-internal-api.jar
glassfish-corba-codegen.jar
gmbal.jar
jta.jar
container-common.jar
glassfish-corba-csiv2-idl.jar
hk2-core.jar
kernel.jar

As mentioned in the Ivan A Krizsan's notes for the EJB certification, and depending on the Glassfish version, this should be enough:
GlassFish 3 (and GlassFish 4 too, I've just tested it): $GLASSFISH_HOME/lib/gf-client.jar
GlassFish 2: $GLASSFISH_HOME/lib/appserv-rt.jar and $APS_HOME/lib/javaee.jar

Related

ActiveMQ integration with Oracle Service bus(OSB) 12c

we are trying to do the assessment around ActiveMQ to use in OSB 12c as JMS based integration. I did follow few blogs like https://bizzperform.com/blog/?p=686 but this is not helping and generating error like below.
did anyone came across this scenario and did implemented same .. kinldy advise.
<Failed to check whether connection factory LocalConnectionFactory supports XA. Will assume it does not: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFoundException:
Active MQ client jar is missing from domain class path, you need to download it and add to PRE_CLASSPATH
Thanks, I finally got it working.
two quick changes and that worked
added the jar file in setDomainEnv.cmd like this
set PRE_CLASSPATH=%DOMAIN_HOME%\lib\activemq-all-5.16.3.jar;%PRE_CLASSPATH%
or you can put the complete URL of domain home.
while configuring the JMS on OSB, its always tricky to set the JNDI and I had to use both like below
jms://localhost:7001//
this helped and established a connection.

can't deploy ear file on Weblogic 12c

i have EAR file contains jar and war packages.this ear file deploy on glassfish correctly but when deploy this ear file on weblogic 12c, get this error :
Unable to access the selected application.
Error Exception in AppMerge flows' progression
Error Exception in AppMerge flows' progression
Error Unable to resolve deadlock in factory claims
Error Unable to resolve deadlock in factory claims
i check application.xml and name of jar and war packages are correct.anybody have idea for solving this issue ?
I too had this problem and tried everything (schemas, project structure, dependant libs, etc). Finally compared my domain with the sample "medrec", the only difference was that I had added SIP support. After removing this support, I can now deploy my EAR with included WAR and EJBs. I assume this is a bug in 12c...
I too had the same problem and I had to create another domain to resolve the issue.The key here is not to use the eclipse tool to create the the domain as the option to create "Basic Weblogic Domain" is not presented.
The option to create a basic weblogic domain is presented when you launch the weblogic domain creation wizard.
I had faced the exact same problem today. This problem is associated with the way the Domain was created. If you have used "Basic WebLogic SIP Server Domain" then it would occur while installing an ear. You can double check if the Domain is created with Basic SIP or not, go to your Weblogic Server Domain >> bin >> setDomainEnv (cmd or sh) file and check if you have the below properties defined.
-- set WLSS_HOME=C:\Oracle\Middleware\wlserver_12.1\sip
-- set SIP_ENABLED=true
I tried to create the Domain again with JAX-RPC extension instead of Basic SIP and got this problem resolved.

Deploy EJB2 on Weblogic 10.3

I try to deploy ejb2 on weblogic 10.3 but I face a problem the deployed ear can't see new methods added to any ejb session bean. I added the method to remote interface and I added the implementation to bean class. I hope anyone can help. Thanks
I believe WebLogic 10.3 supports EJB3, so you'll have to do some modification. You already have the evidence to prove it.
As you say the old EJBs are working, but it's not reflecting updated methods - I think this is cached.
Drill down on your server to the following path or a similar one
DefaultDomain\servers\DefaultServer\cache\EJBCompilerCache
There will be many folders in there with random names like ff7i19ot3cg6 and l443b5vws35h
Clear out all these folders and redeploy the app

How to control glassfish module startup order

I have several web modules. There are dependency between them, say during startup, module B will use MBean exposed by module A. How to configure glassfish to enable it start them by specific order? Or is it possible to configure it to load them concurrently.
I searched quite a lot via google, but not result.
BTW, I'm using glassfish-2
This post indicates that initial deployment order defines the startup order. I have found (on Glassfish 3) that the order is stored in domain.xml so you can swap entries in there.
If they're part of the same EAR and you're willing to move to Java EE 6 and thus GlassFish 3, here's a solution for you : http://blogs.oracle.com/alexismp/entry/module_initialization_order_in_java
GF 3.1 seems to reset the order after editing the domain.xml.

No factories configured while using Jetty 7 embedded + Myfaces 1.2

I am using an embedded version of jetty 7 to load a web application using Apache MyFaces 1.2 in a junit 4 test class on the advice from another thread.
While running the test i get this error.
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
This application works fine with tomcat, weblogic and even oc4j!
How can i get this to work with jetty?
I solved this by adding the myfaces-impl jar which had the .tld file inside the WEB-INF/lib directory.