Getting 'Missing Required Attribute' JiBX error after migrating to WebLogic 12 - java

Good morning,
I've been working on a project where I'm supposed to:
upgrade the application from JRockit 1.6 to Java 7
upgrade the application to run in a WebLogic 10.3.5 environment to run in a WebLogic 12 environment
I'm sure this doesn't help but I'm new to the Java/Spring/WebLogic world.
I was able to upgrade from JRockit 1.6 to Java 7 but when it comes to the WebLogic part, I've been having issues starting the application.
Every time I do, I get the following error
org.jibx.runtime.JiBXException: Missing required attribute "a" (line 1, col 71)
at org.jibx.runtime.impl.UnmarshallingContext.attributeText(UnmarshallingContext.java:975)
at com.mydomain.JiBX_rule_def_bindingMungeAdapter.JiBX_rule_def_binding_unmarshalAttr_1_0()
at com.mydomain.JiBX_rule_def_bindingMutableRuleDefinition_access.unmarshal()
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2900)
and have been trying to debug it for a while now. What's really weird is that when I take out the code from a Spring/WebLogic environment and execute it, it works fine (ie, unmarshalls the data).
When it was in the WebLogic 10.3.5 environment w/ JRockit 1.6 and JiBX 1.2.1 jars, I had zero issues.
Here's what I've tried
upgraded JiBX jars from 1.2.1 to 1.2.5
upgraded xpp3 jars to 1.1.3.4.O
upgraded Spring jars from 2.5.5 to 3.2.11
tried including a weblogic.xml file (didn't have one before) and try to used the
<preferred-web-inf>true</preferred-web-inf>
but no luck
tried including a weblogic-application.xml file and an APP-INF folder (didn't have one before) and tried to used the JiBX as my preffered class for unmarshalling
Here is some more information about the environment I'm working in
Non Maven Environment (had to upgrade .jars manually)
Used Java 1.7.0.45 and .71
WebLogic 1.2.1.2
Spring 3.2.11
JiBX 1.2.5
using MyEclipse Version: 2014 Build id: 12.0.0-20131202
no xsd file just a .xml binding file
<binding>
<mapping name="rule"
class="com.mydomain.MutableRuleDefinition">
<value name="a" field="a" style="attribute" />
<value name="b" field="b" style="attribute" />
<collection field="ruleElements">
<structure name="ruleElement"
type="com.mydomain.MutableRuleElement">
<value name="c" field="c" style="attribute" />
<value name="d" field="d" style="attribute" />
<collection field="values" item-type="java.lang.String"
usage="optional">
<value name="value" />
</collection>
</structure>
</collection>
</mapping>
</binding>
Here is the unmarshalling code:
private MutableRuleDefinition unmarshalXMLRuleDef(String _xmlRuleDef) {
MutableRuleDefinition mruleDef = null;
try {
IBindingFactory bfact = BindingDirectory
.getFactory(MutableRuleDefinition.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
mruleDef = (MutableRuleDefinition) uctx.unmarshalDocument(
new ByteArrayInputStream(_xmlRuleDef.getBytes()), null);
} catch (JiBXException e) {
logger.error("Could not un-marshalling the XML rule definition:["
+ _xmlRuleDef + "]", e);
}
Apparently this was an issue back in JiBX 1.2.1 but was fixed in 1.2.2 :
https://www.mail-archive.com/jibx-users#lists.sourceforge.net/msg04200.html
Any help appreciated. Please let me know if you need more info...
Update #1
I have tried
<value name="a" field="a" style="attribute" usage=optional />
on all the attribute flags and the unmarshalling will work, however, these fields aren't optional so I can't use that as a fix.
Update #2
fwiw, here is an example that would come into be unmarshalled
<rule a="dataForA" b="dataForB">
<ruleElement c="dataForC1" d="dataForD1" />
<ruleElement c="dataForC2" d="dataForD2" />
<ruleElement c="dataForC3" d="dataForD3" />
<ruleElement c="dataForC4" d="dataForD3" />
</rule>

R Hanna,
I would suggest looking at the JiBX dependencies and making sure all of the Jars are the exact same version as the ones used by JiBX. We use some eclipse libraries that often conflict with web server jars.
Also, remember that JiBX is open source. You may want to step through the code and see what is causing JiBX to fail.
One more thing. I can't see your schema definition, but it is strange that the error seems to say that you are missing an attriburte. Are you sure the 'source' attribute is not required.
Good Luck!
Don Corley
JiBX contributor

R Hanna,
I got this resolved for me after using 1.2.5 version of jibx however i made sure all the related jars also updated to 1.2.5 and made sure there are no stale class files present in my war which were created by the previous jars that did the trick for me hope its helps you .

Related

is Hibernate Elasticsearch compatible with wildfly 14

I am trying to index my entities on AWS Elasticsearch cluster, I am currently using hibernate search and local file for it. Therefore, the hibernate integration with elasticsearch is the only option I have, I've followed the hibernate search doc but it ends up with
Caused by: java.util.ServiceConfigurationError: org.hibernate.search.bridge.spi.IndexManagerTypeSpecificBridgeProvider: Provider org.hibernate.search.elasticsearch.bridge.impl.ElasticsearchBridgeProvider not a subtype
I tried to remove all the jars and clean install maven once again, it didn't change anything
I've tried to add the hibernate-search-elasticsearch as a module in wildfly but ends up with many issues as well like Lucene query parser is not found in the class loader (maybe I missed up something while adding the jar as a module )
As I understood I don't need server provisioning since I am using the version which is supported by wildfly (correct me if I am wrong).
I am using:
Wildfly server 14.0.1
Hibernate core 5.3.6.Final
Hibernate search orm 5.10.3.Final
Hibernate search elasticsearch 5.10.3.Final
any ideas what could be wrong? and the better question am I adding the correct dependencies for wildfly?
P.S I know the similar question was asked before but the answer didn't help at all.
All that needed to be done is to add the dependency for hibernate elasticsearch as compile scope and add those properties in persistence.xml.
<property name="jboss.as.jpa.providerModule" value="org.hibernate" />
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm" />

Connection Time out error while parsing hbm file

I am facing this weird issue while opening hbm file. I am using hibernate3.jar. I also verified that there is only one hibernate3.jar in classpath and it contains hibernate mapping dtd file.
I tried to put code and exception here but StackOverFlow engine continuously throwing some error.
Code and exception is given at [link] https://forum.hibernate.org/viewtopic.php?f=1&t=1029004.
I also tried by specifying docBuilder.setEntityResolver(new DTDEntityResolver());
I was running it via Apache Ant and behind proxy.
Any pointers will be appreciated.
Thanks,
Setting proxy values as export
ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
didn't work. So, I set the proxy values in Ant's build file as given in ant documentation and it worked.
<property name="proxy.port" value="80"/>
<property name="proxy.user" value=""/>
<property name="proxy.pass" value=""/>

Hibernate Mapping Changes not taking effect

I have a project using Hibernate and external XML mapping files. I switched from MySQL to Oracle. Some of my fields have the name 'date', which is okay in MySQL but not in
Oracle. It does not like
<property name="date" column="date" type="string" />
so I changed it to
<property name="sdate" column="sdate" type="string" />
When I re-rerun the code to generate the schema, it is still following the old version of the mapping file and not taking into account the new changes. I have even created a similar but different xml file and pointed my Hibernate config to this new file and it has the same problem.
Does anyone know why it could be following the old version of my mapping file and refusing to follow my updates?

OpenJPA in OSGi not finding MySQL JDBC Connector Bundle

I am currently working on an OSGi project on Felix (v4.0.3). I need to use JPA so I have installed the Apache Aries JPA bundles. I also installed OpenJPA and I need it to connect to a MySQL Database, using the MySQL Connector Bundle. Unfortunately it does not work, OpenJPA says it cannot find the MySQL JDBC class and I cannot figure out what's broken, maybe I am doing something wrong. I'll explain below what I installed precisely along with the persistence.xml file and the actual exception I get.
Here's the list of the Apache Aries bundles I installed :
org.apache.aries.jpa.api-0.3.jar
org.apache.aries.jpa.container.context-0.3.jar
org.apache.aries.jpa.container-0.3.jar
org.apache.aries.util-0.4.jar
I then installed the dependencies of those Apache Aries JPA bundles. I downloaded them from Springsource :
com.springsource.javax.transaction-1.1.0.jar
com.springsource.org.apache.log4j-1.2.16.jar
com.springsource.slf4j.api-1.6.1.jar
com.springsource.slf4j.log4j-1.6.1.jar
javax.persistence_2.0.4.v201112161009.jar (this one is from EclipseLink in case it matters)
I also installed OpenJPA and all its dependencies. I found bundles 2 to 5 (commons-*) in the lib folder of the apache-openjpa-2.2.0 downloaded folder. I downloaded Serp here because the jar found in the lib folder wasn't an OSGi bundle. Finally I found the last two bundles (#7 and #8) in Springsource :
openjpa-2.2.0.jar
commons-collections-3.2.1.jar
commons-dbcp-1.4.jar
commons-lang-2.4.jar
commons-pool-1.5.4.jar
org.apache.servicemix.bundles.serp-1.13.1_4.jar
com.springsource.javax.servlet-2.5.0.jar
com.springsource.org.objectweb.asm-3.2.0.jar
Once I finally had OpenJPA installed, I still needed the MySQL JDBC Driver bundle, which I also got from the Springsource repository along with its commons-logging dependency :
com.springsource.com.mysql.jdbc-5.1.6.jar
com.springsource.org.apache.commons.logging-1.1.1.jar
Now at this point the list of bundles installed is getting quite large. I said I installed OpenJPA but it's only because I could not figure out how to use any other provider with Aries. I initially wanted to use EclipseLink but apparently Apache Aries does not detect it as a provider and according to this blog you have to make yet another bundle containing your own activator for Aries to notice EclipseLink. I tried it but it didn't work so I fell back on using OpenJPA instead.
So now I have two questions :
How can I make OpenJPA notice my MySQL Bundle ?
OR alternatively :
How can I make Apache Aries notice EclipseLink ?
Here's the persistence.xml file I use :
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="userManager.model" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.project.dao.entity.UserEntity</class>
<properties>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
<property name="openjpa.ConnectionUserName" value="root" />
<property name="openjpa.ConnectionPassword" value="root" />
</properties>
</persistence-unit>
</persistence>
The error occurs when the following Constructor of my DAO class is executed :
#PersistenceContext(unitName="userManager.model")
private EntityManager em;
private EntityManagerFactory emf;
public UserDAOBean() {
em = emf.createEntityManager();
}
Here's the error I get with OpenJPA not finding MySQL. Of course it is worth mentioning that both the URL and the username/password do work :
<openjpa-2.2.0-r422266:1244990 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/usermanager?autoReconnect=true". You may have specified an invalid URL.
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:844)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1671)
at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:646)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:64)
at javax.persistence.EntityManagerFactory$$Proxy.createEntityManager(Unknown Source)
I've cut the exception (it keeps going on and on) until this point :
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver not found by org.apache.openjpa [12]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:85)
... 108 more
PS: I couldn't post the links to Aries, OpenJPA or EclipseLink because of the spam restriction, sorry :/
Thanks to Holly Cummins and after another bunch of hours of research, I've been able to find a solution to my problem. I'll detail it below, this is going to be a very long answer.
If you want to use EclipseLink with Apache Aries (which I find orders of magnitude simpler to install than OpenJPA for OSGi because it's contained in only 5 bundles), you will have to checkout the EclipseLink - Aries adapter directly from apache because it has not been released yet.
Go to an appropriate folder and execute the following command to get it :
svn checkout https://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-eclipselink-adapter/
You should get a folder named jpa-container-eclipselink-adapter. Now, assuming that you are using Linux and have Maven installed, run the following commands :
cd jpa-container-eclipselink-adapter
mvn clean install
Once Maven has successfully compiled the source of the adapter, you will find it in your Maven repository using the path
<maven-repo>/org/apache/aries/jpa/org.apache.aries.jpa.eclipselink.adapter/0.3.1-SNAPSHOT/org.apache.aries.jpa.eclipselink.adapter-0.3.1-SNAPSHOT.jar
You'll have to deploy this bundle with the others (copying it in the bundle folder for Felix).
So that was for the EclipseLink part, now in order to make your persistence actually work you'll have to use Blueprint with Aries. Here is the list of all the bundles you'll need to get from the [http://aries.apache.org/downloads/currentrelease.html](Apache Aries download page)
org.apache.aries.blueprint
org.apache.aries.proxy
org.apache.aries.jndi.api
org.apache.aries.jndi
org.apache.aries.blueprint
org.apache.aries.jpa.api
org.apache.aries.jpa.container.context
org.apache.aries.jpa.container
org.apache.aries.transaction.blueprint
org.apache.aries.transaction.manager (This one is listed twice on their site, it's just a duplicate)
org.apache.aries.util
Once you're done downloading Aries, you still need dependencies (get them from SpringSource). These are the bundles for SLF4J, Log4J, SLF4J Log4J Binding and javax.transaction 1.1 API.
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.api&version=1.6.1
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.log4j&version=1.6.1
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.javax.transaction&version=1.1.0
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.log4j&version=1.2.16
You'll also need the bundles from EclipseLink (you need the OSGi bundle version)
http://www.eclipse.org/eclipselink/downloads/
Open the zip and get the following files :
org.eclipse.persistence.antlr
org.eclipse.persistence.asm
org.eclipse.persistence.core
org.eclipse.persistence.jpa
javax.persistence
Finally, assuming that you want to use a MySQL database, you'll need the bundles for the MySQL JDBC Driver (downloaded from Springsource)
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.mysql.jdbc&version=5.1.6
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.commons.logging&version=1.1.1
Once you have all those bundles installed, you need to use a non-jta-datasource that you will get through JNDI. Here's a persistence.xml file that you can change for your needs :
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="userManager" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/userManagerDS)</non-jta-data-source>
<class>com.example.dao.entity.UserEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<!-- EclipseLink should create the database schema automatically -->
<!-- <property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" /> -->
</properties>
</persistence-unit>
</persistence>
See the javax.sql.Datasource in the non-jta-data-source tag ? That's what we'll define using Blueprint xml.
In order to do so, you'll first need to add the OSGI-INF/blueprint/ folders in your persistence bundle (the one containing your DAOs and Entities). This is the default folder where blueprint xml files are located, any xml file located here will be scanned. Once that's done, create the blueprint.xml file (the name can be changed) and paste (and modify) the following code :
<bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
<property name="user" value="root" />
<property name="password" value="root" />
</bean>
<service id="MySQLDataSource" interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/userManagerDS" />
</service-properties>
</service>
<service id="userDAOService" interface="com.example.dao.remote.UserDAORemote">
<bean class="com.example.dao.beans.UserDAOBean">
<jpa:unit index="0" unitname="userManager" />
</bean>
</service>
</blueprint>
Here, we are doing two things. First, we tell Aries to create the userManagerDS datasource and configure it with the JDBC Driver, URL, user and password. This is the same datasource that we used in the persistence.xml file.
Then, we inject the EntityManagerFactory in our DAO. Our DAO is the com.example.dao.beans.UserDAOBean class, we need to add its name to the bean tag. This class will have to implement an interface and we'll need to add this interface to the service tag. Now the final jpa:unit tag tells Aries to inject the EntityManagerFactory related to the persistence unit called userManager (the same name we used in the persistence.xml) by using the first constructor of UserDAOBean. This is done by using the index="0" attribute. This also means you have to have some code like the following in your DAO :
private EntityManager em;
private EntityManagerFactory emf;
public UserDAOBean(EntityManagerFactory emf) {
this.emf = emf;
this.em = emf.createEntityManager();
}
It's also possible to inject the EMF using a setter. Here are further resources to help you use Blueprint :
http://aries.apache.org/modules/jpaproject.html
http://aries.apache.org/modules/blueprint.html
http://mail-archives.apache.org/mod_mbox/aries-user/201104.mbox/%3C15F2C30E-2A71-4320-9992-DBCF181B58E4#gmail.com%3E
Optional : Be careful, if you are using Felix, adding the javax.transaction bundle will cause a "uses constraint violation" because the system bundle (bundle 0) also exports this API. You'll have to keep it from exporting it by changing the following line in the config.properties :
#org.osgi.framework.system.packages=
You'll have to put in here the list of all the packages that the previous bundle exported. Unfortunately, there's no way to "remove" a package, you have to redefine the entire list of packages to be exported. Here's mine, I hope it helps (yes it is very, very long) :
org.osgi.framework.system.packages=org.osgi.framework;version=1.6.0, org.osgi.framework.launch;version=1.0.0, org.osgi.framework.wiring;version=1.0.0, org.osgi.framework.startlevel;version=1.0.0, org.osgi.framework.hooks.bundle;version=1.0.0, org.osgi.framework.hooks.resolver;version=1.0.0, org.osgi.framework.hooks.service;version=1.1.0, org.osgi.framework.hooks.weaving;version=1.0.0, org.osgi.service.packageadmin;version=1.2.0, org.osgi.service.startlevel;version=1.1.0, org.osgi.service.url;version=1.0.0, org.osgi.util.tracker;version=1.5.0, javax.accessibility;version=0.0.0.1_006_JavaSE, javax.activation;version=0.0.0.1_006_JavaSE, javax.activity;version=0.0.0.1_006_JavaSE, javax.annotation.processing;version=0.0.0.1_006_JavaSE, javax.annotation;version=0.0.0.1_006_JavaSE, javax.crypto.interfaces;version=0.0.0.1_006_JavaSE, javax.crypto.spec;version=0.0.0.1_006_JavaSE, javax.crypto;version=0.0.0.1_006_JavaSE, javax.imageio.event;version=0.0.0.1_006_JavaSE, javax.imageio.metadata;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.bmp;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.jpeg;version=0.0.0.1_006_JavaSE, javax.imageio.spi;version=0.0.0.1_006_JavaSE, javax.imageio.stream;version=0.0.0.1_006_JavaSE, javax.imageio;version=0.0.0.1_006_JavaSE, javax.jws.soap;version=0.0.0.1_006_JavaSE, javax.jws;version=0.0.0.1_006_JavaSE, javax.lang.model.element;version=0.0.0.1_006_JavaSE, javax.lang.model.type;version=0.0.0.1_006_JavaSE, javax.lang.model.util;version=0.0.0.1_006_JavaSE, javax.lang.model;version=0.0.0.1_006_JavaSE, javax.management.loading;version=0.0.0.1_006_JavaSE, javax.management.modelmbean;version=0.0.0.1_006_JavaSE, javax.management.monitor;version=0.0.0.1_006_JavaSE, javax.management.openmbean;version=0.0.0.1_006_JavaSE, javax.management.relation;version=0.0.0.1_006_JavaSE, javax.management.remote.rmi;version=0.0.0.1_006_JavaSE, javax.management.remote;version=0.0.0.1_006_JavaSE, javax.management.timer;version=0.0.0.1_006_JavaSE, javax.management;version=0.0.0.1_006_JavaSE, javax.naming.directory;version=0.0.0.1_006_JavaSE, javax.naming.event;version=0.0.0.1_006_JavaSE, javax.naming.ldap;version=0.0.0.1_006_JavaSE, javax.naming.spi;version=0.0.0.1_006_JavaSE, javax.naming;version=0.0.0.1_006_JavaSE, javax.net.ssl;version=0.0.0.1_006_JavaSE, javax.net;version=0.0.0.1_006_JavaSE, javax.print.attribute.standard;version=0.0.0.1_006_JavaSE, javax.print.attribute;version=0.0.0.1_006_JavaSE, javax.print.event;version=0.0.0.1_006_JavaSE, javax.print;version=0.0.0.1_006_JavaSE, javax.rmi.CORBA;version=0.0.0.1_006_JavaSE, javax.rmi.ssl;version=0.0.0.1_006_JavaSE, javax.rmi;version=0.0.0.1_006_JavaSE, javax.script;version=0.0.0.1_006_JavaSE, javax.security.auth.callback;version=0.0.0.1_006_JavaSE, javax.security.auth.kerberos;version=0.0.0.1_006_JavaSE, javax.security.auth.login;version=0.0.0.1_006_JavaSE, javax.security.auth.spi;version=0.0.0.1_006_JavaSE, javax.security.auth.x500;version=0.0.0.1_006_JavaSE, javax.security.auth;version=0.0.0.1_006_JavaSE, javax.security.cert;version=0.0.0.1_006_JavaSE, javax.security.sasl;version=0.0.0.1_006_JavaSE, javax.sound.midi.spi;version=0.0.0.1_006_JavaSE, javax.sound.midi;version=0.0.0.1_006_JavaSE, javax.sound.sampled.spi;version=0.0.0.1_006_JavaSE, javax.sound.sampled;version=0.0.0.1_006_JavaSE, javax.sql.rowset.serial;version=0.0.0.1_006_JavaSE, javax.sql.rowset.spi;version=0.0.0.1_006_JavaSE, javax.sql.rowset;version=0.0.0.1_006_JavaSE, javax.sql;version=0.0.0.1_006_JavaSE, javax.swing.border;version=0.0.0.1_006_JavaSE, javax.swing.colorchooser;version=0.0.0.1_006_JavaSE, javax.swing.event;version=0.0.0.1_006_JavaSE, javax.swing.filechooser;version=0.0.0.1_006_JavaSE, javax.swing.plaf.basic;version=0.0.0.1_006_JavaSE, javax.swing.plaf.metal;version=0.0.0.1_006_JavaSE, javax.swing.plaf.multi;version=0.0.0.1_006_JavaSE, javax.swing.plaf.synth;version=0.0.0.1_006_JavaSE, javax.swing.plaf;version=0.0.0.1_006_JavaSE, javax.swing.table;version=0.0.0.1_006_JavaSE, javax.swing.text.html.parser;version=0.0.0.1_006_JavaSE, javax.swing.text.html;version=0.0.0.1_006_JavaSE, javax.swing.text.rtf;version=0.0.0.1_006_JavaSE, javax.swing.text;version=0.0.0.1_006_JavaSE, javax.swing.tree;version=0.0.0.1_006_JavaSE, javax.swing.undo;version=0.0.0.1_006_JavaSE, javax.swing;version=0.0.0.1_006_JavaSE, javax.tools;version=0.0.0.1_006_JavaSE, javax.transaction.xa;version=0.0.0.1_006_JavaSE, javax.transaction;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation.adapters;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation;version=0.0.0.1_006_JavaSE, javax.xml.bind.attachment;version=0.0.0.1_006_JavaSE, javax.xml.bind.helpers;version=0.0.0.1_006_JavaSE, javax.xml.bind.util;version=0.0.0.1_006_JavaSE, javax.xml.bind;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.keyinfo;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.spec;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig;version=0.0.0.1_006_JavaSE, javax.xml.crypto;version=0.0.0.1_006_JavaSE, javax.xml.datatype;version=0.0.0.1_006_JavaSE, javax.xml.namespace;version=0.0.0.1_006_JavaSE, javax.xml.parsers;version=0.0.0.1_006_JavaSE, javax.xml.soap;version=0.0.0.1_006_JavaSE, javax.xml.stream.events;version=0.0.0.1_006_JavaSE, javax.xml.stream.util;version=0.0.0.1_006_JavaSE, javax.xml.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform.dom;version=0.0.0.1_006_JavaSE, javax.xml.transform.sax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform;version=0.0.0.1_006_JavaSE, javax.xml.validation;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler;version=0.0.0.1_006_JavaSE, javax.xml.ws.http;version=0.0.0.1_006_JavaSE, javax.xml.ws.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.spi;version=0.0.0.1_006_JavaSE, javax.xml.ws.wsaddressing;version=0.0.0.1_006_JavaSE, javax.xml.ws;version=0.0.0.1_006_JavaSE, javax.xml.xpath;version=0.0.0.1_006_JavaSE, javax.xml;version=0.0.0.1_006_JavaSE, org.ietf.jgss;version=0.0.0.1_006_JavaSE, org.omg.CORBA.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.ORBPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.TypeCodePackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextExtPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming;version=0.0.0.1_006_JavaSE, org.omg.Dynamic;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP;version=0.0.0.1_006_JavaSE, org.omg.Messaging;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor.ORBInitInfoPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.CurrentPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAManagerPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.ServantLocatorPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.portable;version=0.0.0.1_006_JavaSE, org.omg.PortableServer;version=0.0.0.1_006_JavaSE, org.omg.SendingContext;version=0.0.0.1_006_JavaSE, org.omg.stub.java.rmi;version=0.0.0.1_006_JavaSE, org.w3c.dom.bootstrap;version=0.0.0.1_006_JavaSE, org.w3c.dom.events;version=0.0.0.1_006_JavaSE, org.w3c.dom.ls;version=0.0.0.1_006_JavaSE, org.w3c.dom;version=0.0.0.1_006_JavaSE, org.xml.sax.ext;version=0.0.0.1_006_JavaSE, org.xml.sax.helpers;version=0.0.0.1_006_JavaSE, org.xml.sax;version=0.0.0.1_006_JavaSE
You may have better luck using a JNDI datasource rather than a direct jdbc connection. The Aries blog sample has a blog.datasource bundle which registers a datasource using Blueprint. The list of required bundles is longer than what you currently have, but you can just copy them all from the blog-assembly/target directory or pom.xml.
Alternatively, Aries have an org.apache.aries.jpa.eclipselink.adapter which does the same thing as the article you linked to. Aries use it for testing against EclipseLink, so it definitely should work. You could also look at the Aries tests to see how it's used and see if there's an EclipseLink test you can copy.
Things may be easier when using the gemini blueprint dbAccess plugin (http://www.eclipse.org/gemini/dbaccess/) , which I think will work for Aries as well. For MySQL be sure to include the connector plugin (e.g. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.mysql.jdbc&version=5.1.6). This should be sufficient to get the database up and running, provided the blueprint.xml (to use the example above) is configured properly, as above.

Build failed by schemaExport, HelloWorld program with Hibernate

I am new in Hibernate and try to write my first "helloworld" program. I am using the step in the book "Java Persistence with Hibernate". as I run the build.xml with ant I become the following error. The error came as a schema have to be generate to on the database using hbm2ddl
BUILD FAILED
C:\mypath\build.xml:60: java.lang.NoSuchMethodError: >org/slf4j/impl/StaticLoggerBinder.getSingleton()Lorg/slf4/im/StaticLoggerBinder;
"schemaexport target von build.xml(so sieht die stelle wo der fehler sein sollte aus)"
Translation: "schemaexport target of build.xml(the have to be here, but i cannot found it!)"
<target name="schemaexport" depends="compile, copymetafiles"
description="Exports a generated schema to DB and file">
<hibernatetool destdir="${basedir}">
<classpath path="${build.dir}"/>
<configuration
configurationfile="${build.dir}/hibernate.cfg.xml"/>
<hbm2ddl
drop="true"
create="true"
export="true"
outputfilename="helloworld-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
</target>
I have the following *.jar file in my workdir/lib directory:
antlr.jar
asm.jar
asm-attrs.jars
c3p0.jar
cglib.jar
commons-collections.jar
jcl-over-slf4j.jar
dom4j.jar
hibernate3.jar
hsqldb.jar
jta.jar
thank for reply! I very appreciate.
I am using the latest version of slf4j(slf4j-api-1.6.1). This version come with the hibernate I downloaded, hibernate-distribution-3.6.5.Final, and was located in the folder lib/required of this hibernate version. I also have the following library(jar file):
all ends with .jar
dom4j-1.6.1
hibernate3
hibernate-jpa-2.0-api-1.0.0.Final
hibernate-tools
hsqldb
javassist-3.12.0.GA
jcl-over-slf4j-1.5.4(I also try commons-logging-1.1.1 but nothing change)
jta-1.1
log4j-1.2.16
slf4j-api-1.6.1
Any other idea?
thanks.
This is most likely a version problem: you're using a wrong version of the slf4j library. One of the libraries you're using tries to lookup a certain method, but that method doesn't exist in the version of the library you are using.
Check which version exactly you need by looking in the documentation of the version of Hibernate or other libraries you are using (or try the latest version from slf4j.org).

Categories