Spring cannot find jar outside EAR - WebSphere community edition - spring

I have an ear deployed to WebSphere Application Server Community Edition which uses spring to load different interfaces. For production all those classes are loaded inside the ear. I'm trying to override those classes with another class in a jar outside the EAR.
I placed my jar in /var/shared/lib and have a deployment dependency which I thought would include those folder's into the classpath:
<sys:dependencies>
<sys:dependency>
<sys:groupId>org.apache.geronimo.configs</sys:groupId>
<sys:artifactId>sharedlib</sys:artifactId>
</sys:dependency>
</sys:dependencies>
What am I missing? The spring results in a NoClassDef stating the class cannot be found.

Websphere has a shared library feature. Add your jar in shared library and then add that library in your application usin websphere admin console.
Using shared libraries at the application level
To define a shared library named VersionCheckerV2_SharedLib and associate it
to our ClassloaderTest application, do the following steps:
1. In the administrative console, select Environment → Shared Libraries.
2. Select the scope at which you want this shared library to be defined, such as
Cell, and click New
To add
Select Applications → Application Types→ WebSphere enterprise
applications.
6. Select the ClassloadersExample application.
7. In References, select Shared library references.
8. Select AppName in the Application row.
9. Click Reference shared libraries.
10.Select the VersionCheckerV2_SharedLib and click the >> button to move it
to the Selected column
Use shared library for this task. Use this book for guidence.

Related

How to create a priority service thread pool in IBM WAS 8.5

I have deployed 3 war files in IBM WAS 8.5 (SupposeA.war ,B.war and C.war) ,I want A.war, B.war to be deployed first then C deployment should start.
Is there any way to do it.
This is required as my C.war is dependent on A.war and B.war.
Assuming that you are referring to the order of application start ("deploy" in WebSphere parlance is often used to refer to installation of an application, but that does not appear to be the issue here), then you would want to modify the applications' starting weights, as documented here: https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.iseries.doc/ae/trun_app_startup.html
If these WARs are all part of the same EAR, the WARs' starting weights can be set separately within the EAR in the "Manage Modules" panel within the application configuration in the administrative console.

how to access some new java classes added to the existing jar from gwt project when we run with Maven

I am facing below issue when I am running maven for gwt project.
in my project we have "A" project created by using gwt frame work.
"B" project is a java project and we need to access B project classes in "A" project server side.so created a jar for B project and added in A project build path.
Now I need to add some new classes in B project and that new classes should access from "A" project client side.
We can able to add new classes in B project and after running maven for B-project, we are able to see new classes in B-project jar.
But when I run maven for Project A it shows an error like "did you forget to inherit a required module?".
Note: same test projects I have created and can able to access B-project new classes in A-project client side code. But when I am running with Maven it is unable inheriting these new classes.
Kindly advise me how to solve this issue.
Generally you need to compile your code into javascript in order to make it accessible from the client side (if we aren't considering requestfactory proxies, web services etc. here). If your code is located outside the GWT module it simply doesn't exist for client side. Practically this means that you need to extract the client side accessible classes from the B module and put it into A\shared folder for example. Also don't forget to place <source path="shared" /> into your A gwt.xml descriptor. The drawback of this refactoring of course is that you're allowed to use only "JRE emulated" classes in your shared code.
Another solution would be a creation of a gwt module inside your B project and inheriting it in A project.

WAS cannot load the EJB interface

When I deploy my EAR on WAS 6.1 (EAR was built by Jenkins-Ant), and tryy to start the EAR, I get on SystemOut.log:
[7/28/13 16:33:18:847 EDT] 00000027 ComponentData E CWMDF0015E: The class loader cannot load the com.service.ejb.IntegrationServiceRemote interface on the com.service.ejb.IntegrationServiceImpl Enterprise JavaBeans (EJB) file
The remote interface and the bean implementation have their own jar file and the EAR contains both. I understand the interface should be loaded first, but how to guarantee that? ALso is the error because of the loading order?
Just uninstall the Application EAR from the server. Export new EAR from the RAD and install it manually, it should work.
The MANIFEST.MF file with the entry IntegrationServiceRemote had a typo. Phew !!
It is necessary to click in the paramètrage of publication for WebSphere Application Server of Eclipse IDE "to execute the server and the resources on the server"
and run a server
You might not have mapped the shared library which you have created under the ear file which is deployed. So, go and click on the file you have deployed and under shared library references map the shared library which you have created. Then it will not show this issue.

xmlaccess deploy portlet with library reference

I have problem with deploying JSR168 portlet using xmlaccess. I have no problem with deploy and join to conrete page but I would like to add shared library reference automatically. Is it possible?? I added shared library named 'libshared' using IBM WS console. Can I add this reference in input xml using by xmlaccess?
I don't think you can do this in xmlaccess. But you may try putting a reference to the library under the Manifest.MF file of the META-INF directory of your portlet's war file.
Or could just put the shared jar file under your /shared/ext directory. Or you could put it inside your wps.ear file. Mind you, either of these two solutions would share your library with the entire portal installation, rather than just select portlets.
You can deploy the application using wsadmin or similar and use that to update the classpath (i.e. for the shared library), you can then use xmlaccess to deploy the portlets and reference the previously deployed application - although I think this may only work in WebSphere Portal 6.1.
Give me a shout if you need further details.
I encountered this as well, a while ago... and researched it to the max, including spending some time chatting with IBM's support in various levels.
The XMLAccess protocol doesn't provide for such "system-level" configuration alongside Portlet application deployment; it can only be used to install, customize and uninstall Portlet applications and related artifacts.
If your deployment strategy involves deploying WAR files directly through XMLAccess, then you will have to manually add the shared-library to the application through the WAS admin console; this will have to be done manually because, when deploying WAR files through XMLAccess, an EAR with some random name is being created by WebSphere Portal to "host" your WAR file; hence you can't script the attachment of a shared library.
(alternatively, you may wish to add the shared library to the server's (WebSphere_Portal) classpath)
If your deployment strategy, instead, involves deploying Portlet applications packaged as EARs, then you're in a better position; you could automate the shared-library attachment as part of your EAR deployment process, then use XMLAccess to inform WebSphere Portal about the location, in the EAR, of your Portlet applications (which is what Michael mentioned above; it works in WebSphere Portal 6.0 as well).
Good luck.

Oracle ADF on JBoss: Wrapped Jdbc Connection problem

I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get below exception:
java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection
Is there a way solve this? Maybe configure JBoss to not use this wrapped connection or configure the ADF framework to unwrap it?
This is a while back, but I'll just follow up on my own question.
There is a guide on Oracle Metalink (Needs login) wich explains how to deploy ADF/BC on JBoss. I'm pretty sure this is what solved this for me (it's a while ago..)
Here is a copy of it:
Abstract
The purpose of this note is to show how you create an ADF BC Application Module and how you deploy it on a JBoss Application Server. It will also show you what configurations you need to perform on the JBoss side in order for the Application Module to work correctly.
Scope & Application
This note is intended for anyone who is about to deploy an ADF BC Module to a JBoss Application Server.
How To Deploy an ADF BC Module to a JBoss Application Server
The steps necessary for deploying an ADF BC Module to a JBoss Application Server are the following:
Setup the ADF Runtime Libraries on the JBoss Server
Setup data source(s) on the JBoss Server
Configure the ADF BC Module
Deploy the ADF BC Module
I will go through each of these steps more detailed. There is also a complete example attached for download here.
Setup the ADF Runtime Libraries on the JBoss Server
Shutdown the Application Server.
Invoke the ADF Runtime Installer wizard. Choose Tools | ADF Runtime Installer, and choose a server type from the submenu.
Proceed through the pages of the wizard. For detailed instructions for any page of the wizard, click Help.
On the Location page, select the home (or root) directory of the server on which the libraries are to be installed.
On the Installation Options page, you may choose the operation that you wish to perform.
* Install the ADF runtime libraries from your JDeveloper installation.
* Uninstall previously installed ADF runtime libraries.
* Restore an archived version of the ADF runtime libraries as the active version.
On the Summary page, click Migrate if you wish to prepare any existing UIX JSP projects for deployment.
On the Summary page, confirm the details of the installation, and click Finish.
Restart the application server.
Setup data source(s) on the JBoss Server
To create an Oracle data source in the JBoss server, you need to take the following steps:
Create a file called oracle-ds.xml. This file will contain your data source configuration. Below is an example on how such a file can look like.
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:#mydbhost.com:1521:mysid</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>hr</user-name>
<password>******</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
Copy the file to the /deploy. This will install it on the JBoss server.
Configure the ADF BC Module
There are a few steps that need to be taken upon the ADF BC Module in order for it to run on the JBoss server.
When creating an ADF BC Module that will be used on a JBoss application server, one needs to set the SQL Flavor to SQL92 and the Type Map to Java. This change is required when using JBoss as the Application Server.
****Package the ADF Business Components project as an EJB session bean.****
Right Click on the Application Module, select Business Components Deployment.
In the profiles Dialog, select EJB Session Beans.
In the EJB Session Beans dialog, select Deploy To: Other EJB Container
In the AppModules dialog, configure the Application Module as seen in the figure 1 below.
Figure 1. Configuration of the Application Module
Once done, your Project will look similar to the one shown in the figure 2 below.
Figure 2. The JDeveloper Project
The final step is to configure the Application Module to use the data source we created in the previous step. This is done as follows:
Edit the application module.
In the Navigator, right-click the Business Components application module icon and choose Configurations.
Select the appropriate configuration.
Select this configuration and click Edit.
In the Connection Type list, choose JDBC DataSource.
Enter a DataSource Name. For example: java:/OracleDS.
Deploy the ADF BC Module
If you have your JBoss server either locally or mapped on your local machine, you can deploy it directly from inside JDeveloper. If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module, you cannot deploy it directly from within JDeveloper. Both methods are described below.
Deploying the Module from within JDeveloper
1. Create a connection to the target application server.
2. If you want to support JBoss-specific configuration options for the EJB, add a jboss.xml deployment descriptor file. For more information on this file, see http://www.jboss.org.
3. If your project is a Business Components UIX JSP project, add required Cabo resources to it.
4. Select the deployment profile in the Navigator, right-click, and choose Deploy to | < application server connection> to package the application as an archive file and deploy it via the selected application server connection.
Deploying the Module outside of JDeveloper
If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module you will have to do as follows:
Choose Deploy to EAR file from the context menu to deploy it as an EAR file. You must deploy this application to an EAR file and not a WAR file, as JBoss will not add the EJB references under the java:comp/env/ JNDI namespace for a WAR file.
Copy this file manually to the /deploy directory.

Resources