Which libraries are needed to use hibernate 4.2.0? - java

I searched on Google but each tutorial says different jar libs. Is there a full list of jar that I could have in order to use Hibernate correctly (on Eclipse)?

You can look at maven repository.
You need all the jars that in the /lib/required/ directory. the others are for support for more fitchers like JPA and etc.
but for basic app you can use this jars for version 3 is:
hibernate3.jar (main jar)
antlr-2.7.6.jar
common-collections-3.1.jar
dom4j-1.6.1
jta-1.1.jar
slf4j-api-1.6.1.jar
javassist-3.12.0.GA.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar (for jpa)
Here is a good tutorial for hibernate: java brains

From: http://www.tutorialspoint.com/hibernate/hibernate_environment.htm
Following is the list of the packages/libraries required by Hibernate and you should install them before starting with Hibernate. To install these packages you would have to copy library files from /lib into your CLASSPATH, and change your CLASSPATH variable accordingly.
dom4j - XML parsing www.dom4j.org/
Xalan - XSLT Processor http://xml.apache.org/xalan-j/
Xerces - The Xerces Java Parser http://xml.apache.org/xerces-j/
cglib - Appropriate changes to Java classes at runtime http://cglib.sourceforge.net/
log4j - Logging Faremwork http://logging.apache.org/log4j
Commons - Logging, Email etc. http://jakarta.apache.org/commons
7SLF4J - Logging Facade for Java http://www.slf4j.org

Related

Is apache-camel source code buildable in open-jdk-11?

When building apache-camel with openJDK-11. There are a lot of missing dependencies like
* jaxb
* annotation
* ...
How to build apache-camel source code with openJDK?
Officially there is no documentation on how to build using openJDK; Is there is any way to force build it?
I have tried adding jaxb implementation for server like "org.eclipse.persistence.moxy" but the same wasn't picked up properly :(
I have restricted the build env to be only open source; hence using openJDK as the base for development.
According to this article https://blog.codefx.org/java/java-11-migration-guide/ several packages have been removed from JDK 11.
In particular the section called Migrating From Java 8 To Java 11 shed some light on how to deal with this.
In short the following packages were removed:
The JavaBeans Activation Framework (JAF) in javax.activation CORBA in the packages javax.activity, javax.rmi, javax.rmi.CORBA, and org.omg.*
The Java Transaction API (JTA) in the package javax.transaction
JAXB in the packages javax.xml.bind.*
JAX-WS in the packages javax.jws, javax.jws.soap, javax.xml.soap, and javax.xml.ws.*
Commons Annotation in the package javax.annotation
To fix this:
Add third-party dependencies that contain the classes you need. The easiest way to do that is to stick to the reference implementations (given as Maven coordinates without version – use the most current ones):
JAF: with com.sun.activation:javax.activation
CORBA: there is currently no artifact for this
JTA: javax.transaction:javax.transaction-api
JAXB: com.sun.xml.bind:jaxb-impl
JAX-WS: com.sun.xml.ws:jaxws-ri
Commons Annotation: javax.annotation:javax.annotation-api
You can also view some more information using this Stackoverflow answer

Jetty Server : Memory consumption issue.

We are running a JAVA web application with the help of jetty runner on a customize device board. The device board has some limitation like "SWAP disable"[RAM of 1GB], so whenever we start our JAVA webapplication with jetty, the memory consumption start from 350MB to 900MB gradually;
Eventhough if we try to run a test application [simple html page with our application required libraries- websocket, jersey libraries, pdfbox, opencsv] the memory consumption in the range of 350M-900MB.
Our requirement that the memory consumption should not cross 400MB by JAVA web application. Need suggestion or solution on this issue. Is there any memory leak in jetty server or library?
Jetty 8 is EOL (End of Life). Consider upgrading.
Never mix versions of Jetty (or any artifact)
Your stated list of libraries (you can edit your own question, you know):
amqp-client-3.5.3.jar
protobuf-java-2.5.0.jar
gson-2.2.2.jar
jaybird-full-2.2.8.jar
jackson-core-asl-1.9.13.jar
jackson-jaxrs-1.9.13.jar
jackson-mapper-asl-1.9.13.jar
jackson-xc-1.9.13.jar
javax.annotation-api-1.2.jar
javax.el-3.0.1-b08.jar
javax.inject-1.jar
javax.inject-2.2.0.jar
javax.servlet-api-3.1.0.jar
javax.ws.rs-api-2.0.jar
jersey-client-2.6.jar
jersey-common-2.6.jar
jersey-container-servlet-2.6.jar
jersey-container-servlet-core-2.6.jar
jersey-guava-2.6.jar
jersey-media-json-jackson-2.6.jar
jersey-server-2.6.jar
jetty-http-8.1.17.v20150415.jar
jetty-io-8.1.17.v20150415.jar
jetty-schemas-3.1.M0.jar
jetty-util-8.1.17.v20150415.jar
log4j-1.2.17.jar
log4j-api-2.3.jar
log4j-core-2.3.jar
org.eclipse.jdt.core-3.8.2.v20130121.jar
osgi-resource-locator-1.0.1.jar
slf4j-api-1.6.6.jar
slf4j-log4j12-1.6.6.jar
validation-api-1.1.0.Final.jar
websocket-api-9.3.14.v20161028.jar
websocket-servlet-9.3.14.v20161028.jar
pdfbox-app-2.0.0-RC1.jar
opencsv-3.7.jar
Things to fix:
You have two versions of Jetty: 9.3.x and 8.1.x (pick one, suggest 9.3.x)
You have two versions of javax.inject: 1.x and 2.x (pick one)
You have two versions of log4j: 1.2.x and 2.3 (pick one, suggest 1.2 as your slf4j-log4j12.jar library is using that one)
You are using an outdated jetty-schemas.jar
org.eclipse.jdt.core.jar is for JSP compilation on Jetty 8 (its inappropriate to see in your classpath)
If you are not using OSGi, then remove osgi-resource-locator.jar
If the mentioned libraries are the ones you found in your WebApp's WEB-INF/lib, then the following jars should removed from being present in your WEB-INF/lib as they belong on the server classpath, not your webapp's.
javax.annotation-api-1.2.jar
javax.el-3.0.1-b08.jar
javax.servlet-api-3.1.0.jar
jetty-http-8.1.17.v20150415.jar
jetty-io-8.1.17.v20150415.jar
jetty-schemas-3.1.M0.jar
jetty-util-8.1.17.v20150415.jar
org.eclipse.jdt.core-3.8.2.v20130121.jar
websocket-api-9.3.14.v20161028.jar
websocket-servlet-9.3.14.v20161028.jar

"Use <jaxb:property> to resolve this conflict" error while converting xsd to java objects using jaxb

I am trying to unmarshall elements of xds file to java oblects. I am using Jaxb mavan plugin and Eclipse IDE.
My .xsd file is can be found from
EiPayload
EiEnrollment
EiClasses
Here is my file structure and error,
Need some help to debug this error..!
Disclaimer: I am a lead dev of the ogc-schemas and the w3c-schemas projects.
You have problems with GML 3.2.1 and XLink 1.0. I've implemented bindings for these schemas in the ogc-schemas and the w3c-schemas project. Here you go:
gml-v_3_2_1.xjb
xlink-v_1_0.xjb
But better use the provided JAR artifacts as episodes.

How to use Apache POI in OSGi

I want to use Apache POI in OSGi to write an Excel workbook with the streaming, OOXML API (SXSSF). The streaming API is available since POI 3.9.
As the latest Apache POI 3.11 jars are not bundles: What's the best way to get POI working in OSGi?
I tried two approaches:
embed the jars directly in the only bundle which will be using them
use POI jars prewrapped as bundles
I am despairing in getting all dependencies together.
First about embedding the POI jar in my bundle: my bndtools file contains
-buildpath: \
...
libs/dom4j-1.6.1.jar;version=file,\
libs/poi-3.11.jar;version=file,\
libs/poi-ooxml-3.11.jar;version=file,\
libs/poi-ooxml-schemas-3.11.jar;version=file
Private-Package: \
...
org.openxmlformats.schemas.*,\
org.apache.poi.*,\
org.dom4j.*,\
com.microsoft.schemas.office.x2006.*,\
schemaorg_apache_xmlbeans.*,\
schemasMicrosoftComOfficeExcel.*,\
schemasMicrosoftComOfficeOffice.*,\
schemasMicrosoftComVml.*
This results in a bundle which imports many, many things like for example org.bouncycastle.asn1.x509 and org.junit. I don't plan to encrypt or test in my application - so these two are probably somehow "optional". How can I specify this? Is there a good way of collecting all these dependencies?
Note: at least org.apache.commons.codec and com.sun.msv.datatype.xsd.lib are additionally required, but they are already bundles.
Using prewrapped jars, I tried using org.apache.servicemix.bundles.poi 3.9_2. This also requires dom4j so I used the prewrapped org.apache.servicemix.bundles.dom4j but that requires at least version 1.0 of javax.xml.stream which my JVM/Felix OSGi advertises as "only" version 0.0.0.1_007_JavaSE. I fixed this by hand (ugly), but then got stuck on another dependency.
What's the good way?
We use Gradle with bnd-platform to build OSGi bundles for our applications based on Maven dependencies.
No sure if this is "the good way", but this is how we build the target platform for our OSGi based applications, Apache POI being part of that. It's especially useful in cases where you have to do adaptions to bundles (e.g. make JUnit optional) or merge JARs (e.g. due to classloading issues in OSGi) to make them work.
I set up an example build with an Apache POI bundle (and implicitly, its POM-defined dependencies) on GitHub. You can clone it (sample-poi branch) and try it running ./gradlew clean bundles. Created bundles will be in build/plugins.
Please note that any optional Maven dependencies will not be included by default and have to be added manually to the build, if you need them (due to limitations in Gradle).
I don't have a working example of this work around but this bit of documentation may be helpful to you.
Can POI be used with OSGI?
Starting with POI 3.16 there's a workaround for OSGIs context
classloader handling, i.e. it replaces the threads current context
classloader with an implementation of limited class view. This will
lead to IllegalStateExceptions, as xmlbeans can't find the xml schema
definitions in this reduced view. The workaround is to initialize the
classloader delegate of POIXMLTypeLoader , which defaults to the
current thread context classloader. The initialization should take
place before any other OOXML related calls. The class in the example
could be any class, which is part of the poi-ooxml-schema or
ooxml-schema:
POIXMLTypeLoader.setClassLoader(CTTable.class.getClassLoader());

What is the difference between javax.faces-2.1.14.jar from jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar

I am confused between the difference of javax.faces-2.1.14.jar from jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar
I am trying to make a jsf project without using maven and while searching for examples I saw different jar dependencies on different tutorials. The tutorial from coreservlets uses javax.faces-2.1.14.jar and the other tutorial I saw from a different site uses 2 jar files jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar
Id like to know the difference of these two set of dependencies.
Thanks in advance guys.
The jsf-api-xxx.jar contains classes that are under packages java package javax.faces. The classes in this jar are implementation of standard API defined by JSF specification. The jsf-impl-xxx.jar contains classes that are under java package com.sun.faces, which as the java package indicates, is Sun's own class for JSF implementation.
The javax.faces-xxx.jar actually merges the previous two jar files together. In the Maven repository, it is under org.glassfish groupId. You will find both javax.faces and com.sun.faces java package inside.
So what should you use for your development? Actually you can use both. But the recommended way is to include jsf-api-xxx.jar only in the compilation classpath. Thus your own application does not depend on any classes under com.sun.faces package to achieve the portability to other JSF implementations. If you are using an application such as GlassFish, the container should already provide the JSF implementation at runtime. You should not package the above JSF jar files with your war or ear file, as server will provide all of them. If you use a container that does not come with a JSF implementation by default such as Tomcat, you need to package javax.faces-xxx.jar or (jsf-api-xxx.jar + jsf-impl-xxx.jar) in the WEB-INF/lib.
They are different versions.
javax.faces-2.1.14.jar is a combined JAR file for 2.1.14
jsf-api-2.2.0-m05.jar and jsf-impl-2.2.0-m05.jar are separate JARs for 2.2.0-m05.
The differences between the versions can be found in the release notes, but 2.2 and 2.1 are non-trivially different.

Categories