glassfish v3 remote jboss EJB client - ejb-3.0

I have some interesting issue regarding calling EJB 3 stateless deployed on Jboss 5 from
Glassfish v3.
I managed to do this successfully on glassfish 2.1 and jboss 5, by packing Jboss client jars with my app, but now when I do the same thing on gf3 I get ClassNotFoundException for many of jboss classes (other then ${jboss home/client}) and I just keep adding those jars but there seems not to be an end to that..
Why gf 3 requires more jboss classes then gf2, I uses the same code!?
also how can I config gf3 to look for that jar files other then to put them in domains lib dir?
Tnx for help :)

Howzit,
I found the same thing , in GF3 you have to add in insane amount of libraries to get a stand-alone client working , here is the list I found got my client working :
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

Related

LinkageError on WebSphere 9 for javax.transaction.* classes

I have a web application that used to run fine on many web servers (tomcat, jboss, weblogic and websphere). Now, however, it has an error when deploying on WebSphere 9.
The app contains the jar javax.transaction-api-1.2. Some of its classes, e.g., javax.transaction.xa.XAResource, are also included in Java SE, but not all of them. Some are specific to Java EE and are required by some 3rd-party libraries in my app. The app is always deploying with child-first (parent-last) classloader.
WebSphere 9 throws this error during startup when the app tries to load the Oracle JDBC driver:
java.lang.LinkageError: loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader#7157be44" previously initiated loading for a different type with name
"javax/transaction/xa/XAResource" defined by loader "com/ibm/oti/vm/BootstrapClassLoader#422c7b1b"
Note that we aren't actually using XA transactions in the app, we are using regular transactions.
On other servers, and previous versions of WebSphere, it was never a problem. The server didn't care that we load XAResource from inside the war, even if it was previously loaded somewhere in the server. Now WebSphere 9 is different, it says that the app classloader already loaded this class from the server, but I don't know why or when did this happen.
Any idea how to solve this?
Remove the transaction API from your application. JTA 1.2 is already included in the server and provides no value in your applications. It's always risky to bring Java EE/SE APIs in a parent-last class loader unless you are 100% certain that they are technically necessary, because they can lead to issues like this one.
I can't say how this worked in previous server versions (there have been some Java-level changes in enforcing linkage issues like this), but the solution is reasonably straightforward.
At the end we did two things to solve this problem.
1) We upgraded the jta jar to version 1.3 (link here). This jar solves the problem by avoiding duplicate classes - it contains only J2EE classes and omits the J2SE classes that are already included in the JVM.
2) We upgraded WebSphere server from 9.0.0.7 to 9.0.0.11.
At the time, I suspected just upgrading the jar should suffice, but our QA had some issues with it and they also upgraded the server. Due to lack of time, we didn't investigate it further and just decided to do both.

Apache Tomee session Management with gemFire Integration

I am trying to do session management using tomcat modules in gemFire. Reference link we used is [https://gemfire.docs.pivotal.io/95/geode/tools_modules/http_session_mgmt/tomcat_installing_the_module.html].
Application server that we are using is tomee 7.0.5. After making the changes mentioned in the link. When i tried to make the server up, we were getting an error "getContainer() method not found in class DeltaSessionManager".There is a module geode-modules-9.5.1.jar provided by gemFire(gfsh Client) which helps for session management. Inside that there is a class DeltaSessionManager which extends another class org.apache.catalina.session.ManagerBase . But the ManagerBase class in catalina.jar inside tomee 7.0.5 doesn't have this method. But when we downloaded tomcat catalina jar separately we were able to see this method. Is there any difference in the approach for tomee.
Any help would be appreciable
Looking at the tomee source code, I suspect tomee 7.0.5 is actually embedding Tomcat 8. In that case, you need to use Tomcat8DeltaSessionManager, which supports Tomcat 8 and above.

Using Spring Insight with Tomcat 6

I want to use Spring Insight with Tomcat 6. I cant use TC server because of reasons beyond my control. So I am looking at integrating Spring Insight with Tomcat 6. Has any one worked on this before or can any one point me to any documentation.
Thanks,
Anuj
Insight Developer (the free product) comes in two form, packaged with tc Server Developer and packaged with STS. Neither option will provide an easy mechanism for installing Insight into Tomcat. I'm not saying that it can't be done, there is just no simple way to do it.
If you really want to run Insight on Tomcat then you are going to need to do some work. Here are the rough steps that you'll need to do.
Download vFabric tc Server Developer
Create a vFabric tc Server instance which has Insight enabled.
Download the latest Apache Tomcat 6.0.x or 7.0.x
Copy the following files & folders from the tc Server instance w/Insight
bin/setenv.sh
bin/insight-bootstrap-tcserver-1.8.3.RELEASE.jar
insight
lib/*
webapps/insight.war
Edit conf/server.xml and add the following Valve to the Engine block.
<Valve className="com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve"/>
Edit conf/context.xml and add the following before the closing Context tag.
<Loader loaderClass="com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader" />
<Listener className="com.springsource.insight.collection.tcserver.lifecycle.ApplicationLifecycleCollectionListener" />
Start the Tomcat instance.
Alternatively, Insight Operations (a paid product) makes this much easier and offers an installer that allows you to easily and quickly add the Insight Agent into different containers, including ASF Tomcat. Here's a link to the documentation.
http://pubs.vmware.com/vfabric51/topic/com.vmware.vfabric.tc-server.2.7/operations/install-agents.html
I think this instruction can be helpful for you http://blog.jelastic.com/2012/11/28/application-monitoring-in-the-cloud-with-spring-insight/
Actually in this tutorial Tomcat is a cloud instance, but I guess it is suitable for local installation too.
I downloaded vfacbric-tc-server-2.9.6 and followed the instructions mentioned by Daniel Mikusa to set up insight on tomcat 7. Unfortunately tomcat was not able to find the classes HttpRequestOperationCollectionValve, TomcatWeavingInsightClassLoader and ApplicationLifecycleCollectionListener in the jars provided. After struggling 2 days adding new jars containing these classes and getting class clash., finally I figured out that just removing the configuration in server.xml and context.xml are sufficient to get insight working on tomcat.
So, all you need to setup insight on tomcat are the steps 1 to 4 and 7 in his answer. I'm copying the same for the ease of others
Download vFabric tc Server Developer
Create a vFabric tc Server instance which has Insight enabled.
Download the latest Apache Tomcat 6.0.x or 7.0.x
Copy the following files & folders from the tc Server instance w/Insight
bin/setenv.sh
bin/insight-bootstrap-tcserver-1.8.3.RELEASE.jar
insight
lib/*
webapps/insight.war
Start the Tomcat instance.
I am trying to follow the updated instructions provided by "nagamanojv". I am able to start http://localhost:8080/insight/ on Tomcat 6, but I do not see any applications. I have deployed one of my web applications on the same tomcat instance. Let me know if I am missing anything.

WebSphere 8 : JAX-WS client for Axis2 WS

I am trying to write a JAX WS client for a service exposed using Axis2, WebSphere8, Java 1.6.
Standalone client(i.e. client running in my local machine) works fine but when I deploy the client in a application running in same websphere server I get
java.lang.ClassCastException: Cannot cast class org.apache.axis2.jaxws.spi.Provider to class javax.xml.ws.spi.Provider
at line OpenPortType service = OpenService
.create(wsdlFile.toURL(),
new QName( "http://www.test.com/schemas/public/open-api/Open/","OpenService")).getPort(
OpenPortType.class);
When I tried to google I found similar problem existed in weblogic : https://wso2.org/jira/browse/CARBON-4835
When we see source of axis2.jaxws.spi.Provider class we come to know that it's a subclass of javax.xml.ws.spi.Provider !!
I'm wondering what could be wrong ? Any idea ?
Unless you are calling Axis2 capabilities directly, rather than simply using JAX-WS APIs, you do not want to package Axis into your EAR. WebSphere does provide its own JAX-WS implementation which I'm not surprised conflicts with another JAX-WS implementation you've deployed in your app. (In particular, note that WebSphere's own implementation is based on Axis2.)
If you do need to deploy a different implementation, you'll probably have to at least adjust your WebSphere classloader policy to parent_last. There might be more to do as well; it's been a while since we did this ourselves. But it's much easier and cleaner to use the built-in JAX-WS implementation, which means not deploying any of those jars at all.

How do I declare a data source for GlassFish?

I know how I'd do this using JBoss: create a *-ds.xml file, and drop it into my deploy directory.
Is there a declarative way to do the same with GlassFish (v3.1)?
Am I thinking about this the wrong way? (See next question)
Is there a more-Glassfishy way to get my Java EE application to talk to a database?
Other potentially-revelant info:
I want to connect to a SQL Server 2008 database
I'm using Eclipse + GlassFish Server Tools
I know next to nothing about GlassFish. I'm much more familiar with JBoss
You can define it in application.xml or ejb-jar.xml of your EAR. You can even use annotations.
Long answer short: DataSource Resource Definition in Java EE 6.
BalusC is right (+1), with Java EE 6 you can declare datasource definitions either through annotations or through the use of deployment descriptors in a standard and portable way.
Just in case you'd be also interested by creating other resources than datasources like JMS resources, you can also package a glassfish-resources.xml file as part of your application. See:
Supporting glassfish-resources.xml
4.1.3 Application scoped resources

Resources