Bluemix - jaxb jar - ibm-cloud

My application uses jaxb jar (jaxb-impl-2.2.1.1.jar)from apache wink.
I deployed my application on bluemix.
When it accesses com.sun.xml.bind.marshaller.CharacterEscapeHandler it fails with NoClassDefFoundError on bluemix.
Does bluemix use some other version of this jar which does not have this class?
How can I check this?

Enable jaxb-2.2 feature:
cf set-env <appname> JBP_CONFIG_LIBERTY "app_archive: {features: ["jsf-2.0", "jsp-2.2", "servlet-3.0", "ejbLite-3.1", "cdi-1.0", "jpa-2.0", "jdbc-4.0", "jndi-1.0", "managedBeans-1.0", "jaxrs-1.1", "jaxb-2.2"]}"
You can also try using OpenJDK
cf set-env myapp JVM 'openjdk'

When you're running on Liberty, you mustn't include the wink jaxb jar in your application and your code should only depend on classes included in the jaxb spec (mostly in the javax.xml.bind package) and not on any wink-specific classes.
You then just need to include the jaxb-2.2 feature in your server.xml.
There's a tutorial for developing jaxb applications on liberty which walks through the steps needed to configure your development environment and your liberty server.

Related

Is it possible to deploy akka-http to JBoss?

We are developing an akka-http application. Our infrastructure team requires us to deploy it to JBoss. Is it possible, if yes, how?
I found a plugin called xsbt-web-plugin, it converts a sbt application to a war file. That's all I have so far.

WebSphere Developer Tool 8.5 doesn't support to deploy EJB 2.1

My Dev Env as below.
Eclipse Juno with Webshpere Developer tools plugin
WebShpere 8.5
I have a project with below facets.
EJB Module 2.1
Java 1.6
WebSphere EJB (Extended) 8.5
When I used "prepare for deployment", there's nothing happened that those stubs class weren't generated. After searching in Internet, I realized that Webshpere Developer tools 8.5 just supports EJB 3.0 or greater.
My project was migrated from WAS6.1 which the tools can support EJB2.0.
Now I don't want to upgrade my project to EJB3.0.
Can anyone help to raise a solution? A extra deployer plugin or something?
Thanks in advance.
Here are possible solutions:
Deploy during installation
You can continue to develop your application in WDT, then export your application as ear. When you install your application to WebSphere, there is an option to Deploy enterprise beans during. If you check that option WebSphere will generate required classes during application installation.
Run ejbdeploy command or ant wsejbdeploy ant task.
Once you have your ear, you can run ejbdeploy commandline tool to generate code, or if you are building your application using ant you can use ant task for this.
ejbdeploy command refrence
Older article about using ant tasks
Error using Ant to create EJB after upgrading WAS from 6.0 to 7.0
Use IBM Assembly & Deploy Tools for WebSphere Administration v8.5 tool
If you have WebSphere Application Server license, then you can download additional tool - IBM Assembly & Deploy Tools for WebSphere Administration v8.5 tool - this is simplified RAD (Rational Application Developer), based on Eclipse. which will allow you develop your Java EE application and also generate deployment code.
Here is brief description of functionality of the older version of this tool:
Assembly and Deploy Tools

Deploying Java project in Weblogic server

I have created a Java project. Which has a JMS Listener onMessage. How to deploy this java project in the weblogic server? There is another webproject in the weblogic server which will place an object in the Queue, that object needs to be consumed by my Java project. I need this Java project to be deployed independently. Please help.
Thanks,
Arvinth

Eclipse doesn't import all Axis2 jars but project still runs on Tomcat?

When I develop an Axis2 web service on Eclipse, I noticed that Eclipse is automatically copying the classes from the lib folder of Axis2 to the lib folder of the new project. However, not all classes from the lib folder of Axis2 are being copied. Interestingly, the web service runs without any problem when deployed to Tomcat via Eclipse even if some the jars from Axis2 were not copied. Also, when I viewed the temp file of Tomcat, Tomcat seems to generate the jars for the listed modules on modules.list of the web service.
Can someone enlighten me regarding what is happening on this? Why Eclipse doesn't copy all the jars from Axis2? Why can the web service run on Tomcat even without the other jars from Axis2? What are those temp files for? When and why is it being generated?
I tried to run the same project on WebSphere and I am encountering a ClassDefNotFound exception because of the missing jars. My problem was solved when I copied all the Axis2 jars that was not copied by Eclipse to my project. But I'm not comfortable with my solution because Tomcat can run my project even without those jars. Is my solution really the right solution? Or am I missing a configuration setting?
This is just for clarification:
My web service is already running in Axis2. My class loading policy is set to PARENT_LAST. I know that since WebSphere has its own Axis2 configuration, the class loading policy must be set to PARENT_LAST so that WebSphere will use the Axis2 from the project itself. Aside from setting the class loading policy, I did something to make my web service run on WebSphere. I describe what I did above. My question is why such method must be taken?
WebSphere has it's own axis2 configuration as part of its Java EE server spec for JAX-WS. Change your class loading policy to PARENT_LAST and check if that solves your problem.
Edit:
As the original post already states: WebSphere is a Java EE server depending on version it supports its the standard Java JAX-WS web services. Actually web services became part of the standard jdk.
If you use JAX-WS like mentioned in Introduction to JAX-WS or building web services then you don't have to add any 3rd party library for getting your web services running. As soon as you use the non JDK implementation like axis2 you have to package it with your application.
IBM didn't just pack the axis2 into their WAS/JDK, they modified it. I'm not sure what Tomcat delivers, however as long as you use JAX-WS it shouldn't matter. With JAX-WS you don't have any direct import of the org.apache.axis packages. If you use these imports you have to supply the libraries and make sure that yours are loaded.

How to deploy EJB on server?

I am learning EJB3 from last few days. I have many questions regarding EJB, application servers and deployment of EJB.
To start with, I have created one simple helloworld stateless session bean but I don't know how to deploy it on server. It has single bean class, bean interface and one servlet client. I have used eclipse to develop this project.
None of the books that I read gives step by step details about how to put EJB on server and how to access those beans.
I have JBoss 6 server and I also have Java EE budle downloaded from sun website. Does this Java EE bundle contains Glassfish server? or do I need to download it separately?
Can anyone please give me step by step details of how to put my bean and its client on server (JBoss or Java EE)?
And why do we need to include bean interface class in EJB client code? I mean either we need to keep client and bean in same package or if we keep them in seperate packages we need to import bean interfaces in client code. Am I right?
With Java EE 6, you can package your Servlet and your EJB in a WAR (either package your EJB in a JAR and put it in WEB-INF/lib or simply put all classes in WEB-INF/classes). And to deploy this WAR, copy it to:
$GLASSFISH_HOME/domains/<domain1>/autodeploy for GlassFish v3*
$JBOSS_HOME/server/default/deploy for JBoss 6
With Java EE 5, you'll have to package your code in a EAR.
And if you want to deploy your application from Eclipse (using the Eclipse WTP), you'll have to install the appropriate server adapter. For Eclipse Galileo and GlassFish (there is currently no adapter for JBoss 6 AFAIK), right-click the server view, select New > Server, click on Download additional server adapters and select the GlassFish adapter. Finish to define your new GlassFish v3 Java EE 6 server and deploy your application on it (right-click on your application then Run As > Run on Server). For Eclipse Helios and GlassFish, you can follow the link given by #VonC (manual install) or check this answer (install via the Update Site).
You need to add GlassFish to your Eclipse installation (see GlassFish plugin for Eclipse).
The full process is described here (with the latest Eclipse Helios 3.6M6)
You should export as EJB into your jboss<version>\server/default/deploy folder and then add the build path for it on the servlet's web project. You can "Run on Server" and choose an application server just like you would in any project, no need to export the WAR although if you do that, you're gonna have to re-export your WAR every time you modify your code
AFAIK there's no Eclipse plugin for JBoss 6 but Eclipse provides one for 5.1