I use jboss 4.2.3
In my mbean I have:
Code:
try {
new Configuration()
.addXML(mappings)
.setProperty("hibernate.session_factory_name", "hibernate/Test")
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect")
.setProperty("hibernate.connection.datasource", "java:/db")
.setProperty("hbm2ddl.auto", "update")
.setProperty("current_session_context_class", "thread").buildSessionFactory();
} catch (Exception e) {
e.printStackTrace();
}
where mappings is:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="foo.Client">
<id name="id"
type="long"
column="id">
<generator class="increment"/>
</id>
<property name="name"
type="string"/>
<property name="pasport"
type="java.lang.String"/>
<property name="inn"
type="java.lang.String"/>
<property name="kpp"
type="java.lang.String"/>
<property name="comment"
type="java.lang.String"/>
</class>
<class name="foo.Goods">
<id name="id"
type="long"
column="id">
<generator class="increment"/>
</id>
<property name="name"
type="string"/>
<property name="PrintName"
type="java.lang.String"/>
</class>
</hibernate-mapping>
Code:
I recieve
org.apache.xerces.parsers.ObjectFactory$ConfigurationError: Provider PK not found
at org.apache.xerces.parsers.ObjectFactory.newInstance(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:51)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:187)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:150)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
at org.dom4j.io.SAXReader.read(SAXReader.java:435)
at org.dom4j.io.SAXReader.read(SAXReader.java:365)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:435)
when my code is executed. If I put xerces.2.6.2.jar from hibernate distribution into /deploy/ dir, it works well, but I can't redeploy anything because jboss complains that it can't parse xml.
How can I make configuration with mappings in string?