jar file in persistence.xml not loaded by glassfish - java

folks,
i understand this is a silly question... bt i am so new to glassfish...
i have got an ear to deploy to deploy in glassfish 3. the ear has a jar and war inside already. the jar is a JPA jar and it has persistence.xml file. i have added a jar-file entry to load inside the persistence.xml file, with a jar entry which is not in the ear to be deployed. Where should i put the jar for glassfish to load it
( i have tried putting it in all lib folders in the glassfish dir and even inside various places in the ear only. there is something with lazy deployment i guess... so please suggest me a way to somehow solve this.)
thank for your time,
rajan

okay, what i did was created a lib folder inside the ear, put the additional jar there and in the persistence.xml file inside the ejb jar, i had set the jar-file value as lib/jarname and it recognized...
thanks for yure time guys...
rajan...

Related

Add Jar into tomcat project

I have a project which run in tomcat.
I have this error from tomcat.
java.lang.ClassNotFoundException: net.glxn.qrgen.javaase.QRCode.
I know that this error occur because I did not import my JAR file when I was building the WAR file but then I do not have the source code anymore which mean I cannot build a WAR file again.
Just wanna to know is there a way for me to put my JAR file into tomcat so the related function will call the JAR?
Thanks.
You should be able to copy the jar straight into $CATALINA_HOME/lib and it should work.

Weblogic's Ear shared properties file

I got an Ear with a war inside, deployed in Weblogic 12c.
The project is a Maven multi-module project.
I'm trying to find a very simple way to accomplish my boss's request to put an unique properties file inside the ear (let's say in src\main\application\config), and access it by any module project.
No file within domain server (so the file got to be located in the ear) and no command input lines are allowed.
I've tried to read how to weblogic handles custom global property file here:
External properties file with Weblogic
...hey what is this mess? Seriously...everything in weblogic got to be so complicated?
Maybe with a maven plugin am I able to copy during build the property file inside any "src\main\resources" folder of the other sub-modules?
Any idea is appreciated...
thanks!

diffrence between adding jars files in lib folder and setting it in classpath

could you please explain the difference in addng jars in lib folder and adding jars to classpath .
are both just a way to add jars(anyone will work) or is there any difference ?
I tried searching but couldn't find any answer.
If you have a web application project that bundles into a WAR, then adding the jar files into WEB-INF/lib will automatically put all these jar in the classpath of the application when being deployed in a servlet container (Jetty, Tomcat) or in an application server (GlassFish, Wildfly). Note that these libraries will only be available for your single application being deployed, not for any other app deployed in this server.
If you have a simple jar with a lib folder inside it, then adding any jar into this folder will do nothing. For jar files that must be executed on their own, you need to specify the libraries to use in the classpath, otherwise your jar will not run. For this case, it will be better to have the libraries inside a lib filder outside the jar, so you could reference them in the MANIFEST file. On the other hand, you may use maven to generate a fat jar.
If you are using any third party jar files then you need to add it in classpath because you java application tries to find out the class which you are using in you app.
Adding jars in classpath means you are explicitly adding the jar files in classpath at the time of execution.
Adding jars in lib folder will be done in eclipse will internally add the jar files in classpath at the time of execution.
To verify both the things execute the following command
ps -eaf | grep -i java
which will display your app with the dependencies(jar files) in classpath.

Gradle WEB-INF/classes folder

How can I create WEB-INF/classes in war when I don't have anyone?
In my war I have only web.xml.
I need this because jboss. It cannot deploy project without this folder.
I need gradle configuration.
Add a fake text file to src/main/resources, and it will end up in WEB-INF/classes. Explain the purpose of this file by writing it in the file.

persistence.xml not getting added in ear

We have a maven project with ejbs and stuff. When i run a build and create my ear, the persistence.xml doesnt get included inside the ear. What could be wrong here?
You can add you file persistence.xml under \src\Main\application\META-INF, then the file will be added under your META-INF folder of your ear.
Regards,

Categories