i am wondering what is use of jbossall-client.jar ?
Up to JBoss version 4.2.3 these file contains client code for application.
But since JBoss 5.0 these file contains only dependences against other libraries from server client directory. If you want use it you must put also other jar file on in the same directory as jbossall-client.jar. These is excerpt from readme.txt file from jbossall file:
This jar file contains a classpath reference to various client jar files used by jboss client applications.
Each of the jar files in the following list must available in the same directory as the jbossall-client.jar, Otherwise they will not be found by the classloader.
In readme.txt you can also find the list jar files against which jbossall-client has dependencies.
It's a bundling of all JBoss client code into a single JAR, for those who don't want to bother with selecting the individual smaller JARs.
Related
Hai i am developing a web application my project need to refer lib(jar) file from server, So I do not want to keep my jar file in project i need to refer the path of the jar files available in server by this i can reduce my .war file size. How can i make this reference in Jboss Server.
the first step you have to add your lib in jboss server like a module, have a look at :
http://www.mastertheboss.com/jboss-server/jboss-as-7/how-to-install-a-module-on-jboss-as-7
Next if you use Maven for dependencies, add provided to your lib dependency, in that way while packaging the .war maven will keep the jar in your lib and it will be provided by the server.
this can also be helpful : https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Add_an_Explicit_Module_Dependency_to_a_Deployment1.html
Have a look at the class loading documentation. That should give you the information you need.
I'm testing a web application with Eclipse + Tomcat, Eclipse deploys the web application files and launches Tomcat, and the application runs fine. But when MyBatis is trying to open it's XML configuration files, it looks for them in
C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\persistence\db\oracle.xml
instead of the correct place:
C:\workspace\mywebapp\src\persistence\db\oracle.xml
Where is MyBatis supposed to look for XML files?
EDIT:
This is where I specify the relative path:
String cfgFile = "persistence/db/oracle.xml";
Reader reader = Resources.getResourceAsReader(cfgFile);
session.put(db, new SqlSessionFactoryBuilder().build(reader));
Resources.getResourceAsReader looks files in classpath. For web application running in tomcat classpath consist of WEB-INF/classes and all jars from WEB-INF/lib and tomcat folders like $TOMCAT_HOME\lib.
The issue you encounter most probably is caused by the fact that oracle.xml file is not added to deployment. It looks like c:\workspace\myweapp\src is not among source folder of eclipse project so eclipse doesn't copy files from it to the folder which is deployed to tomcat. Depending on your existing project structure you may need to create subfolder in src and add persistence with all subfolders there. This will allow you to avoid clash if some subfolder of src is already a source folder in eclipse. I would recommend to use maven project structure:
src
main
* java
you java source code here organized by package
* resources
persistence
I marked folders which should be added as source folder to eclipse with *.
Please note that it is not correct to say that C:\workspace\mywebapp\src\persistence\db\oracle.xml is a correct place to search for it. After you create a war to deploy it on production this path most probably will not be available at your production server. What you really need is to include persistence\db\oracle.xml to the war in appropriate place (under WEB-INF/classes).
Maybe you need another class loader 1. Try this:
String cfgFile = "persistence/db/oracle.xml";
ClassLoader classloader = Thread.currentThread().getContextClassLoader()
Reader reader = Resources.getResourceAsReader(classloader, cfgFile);
Notes
See Difference between thread's context class loader and normal classloader and you may want to see the code of org.apache.ibatis.io.Resources. You find it here.
I am using JBOSS 7
In my custom jar I am implementing an Interface. The interface is in a jar packaged with ECM.ear file. Unless I put my custom jar inside the web-inf/lib folder (of the war file located in ear file) I am getting ClassNotFoundException w.r.to the interface.
I created a module for my custom jar but I don't how to set up a dependency with ear file. I copied the jar containing the interface say mdm.jar and placed it in the module and also added an entry in the resource root of module.xml. After restarting I am getting ClassNotFoundException for the classes referred by mdm.jar, which arein ear file.
How to achieve this dependency?
Thanks,
Raghu
JBOSS 7 needs you to place the packaged jar files in the lib folders of your web-inf/lib or the ear/lib cos of the Class Loading Precedence that JBOSS server follows.
Alternatively you could load it as a module, but you need to specify any addition of this kind outside of JBOSS default supplied modules using your MANIFEST file or jboss-deployment-structure.xml
This link should provide you more insight on what would suit you best.
Hope it helps.
I recently started learning more about JBoss Application sever. After installation I was looking inside all directories created by JBoss installation. (I'm using JBoss AS version - jboss-5.0.1.GA)
I referred documentation available at this link
It says 'client' directory contains Jar files needed by remote clients.
client: The JARs that are required for clients that run outside of JBoss are located in the client directory.
When I looked inside 'client' directory after installation, it contains 90 jar files overall. Does that mean If I create a remote ejb client I would need to include all the 90 jars in my remote application classpath?
With JBoss AS 5.x things got complicated.
Placing all of the client jar files on classpath will certainly work.
In JBoss 4.x there was an option to use jbossall-client.jar which integrated other numerous client libs into single file. If you'll look into same named jar in JBoss 5.x you'll find out that it's reduced to manifest referencing other jars. Placing this single jar in your classpath will work as long as all of the jars referenced by manifest are present in the same directory.
If accessing remote EJB is all you need then only a subset of jars is required, unfortunatelly it's hard to tell which ones is it.
Following this coderanch link (I've found it here on SO) you'll find such subset prepared for JBoss 5.1.0.GA.
Be warned though, list of jars published on coderanch has abbreviated names, some misquotations and at least two jars are not present in server version 5.0.1. If reducing number of dependencies is your priority, use this list wisely and enhance/extend it by trials and errors.
for adding jars, when i select Deployment assembly-add-java build path entries...i have nothing ....no jars are there to select....what should i do?Please send me the ans.
Building WAR/EAR's uses a different mechanism from the Java Build Path. You will need to include jar files specifically in this list to have it included in the generated file.