tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bibhuti <bibhuti.ku...@gmail.com>
Subject Re: Unmarshalling error when I rename my mapping file to make sure at runtime this mapping is referred not the generated one.
Date Wed, 09 Jan 2013 05:00:35 GMT
Hi,

What I  understand  if I supply  my META-INF/openejb-cmp-orm.xml then it
should not create openejb-cmp-generated-orm.xml or while creating
openejb-cmp-generated-orm.xml it should refer openejb-cmp-orm.xml. I  have
added my  persisten.xml,openejb-jar.xml and openejb-cmp-orm.xml.

Also, One more thing when I rename my  file to openejb-orm.xml it is not
throwing the below exception.But it not referring the content from  the
changed mapping file(openejb-orm.xml).


------------------------------------------------------------------------------------------------------
Exception :

WARNING: Jar not loaded.
E:\Softwares\apache-tomee-1.5.1-plus\apache-tomee-plus-1.5.1\apps
\EntityBean.jar.  Cannot unmarshall the openejb-cmp-orm.xml file:
jar:file:/E:/Softwares/a
pache-tomee-1.5.1-plus/apache-tomee-plus-1.5.1/apps/EntityBean.jar!/META-INF/openejb-cmp-o
rm.xml: unexpected element (uri:"http://java.sun.com/xml/ns/javaee",
local:"entity"). Expe
cted elements are
<{http://java.sun.com/xml/ns/persistence/orm}package>,<{http://java.sun.
com/xml/ns/persistence/orm}sequence-generator>,<{http://java.sun.com/xml/ns/persistence/or
m}mapped-superclass>,<{http://java.sun.com/xml/ns/persistence/orm}named-query>,<{http://ja
va.sun.com/xml/ns/persistence/orm}access>,<{http://java.sun.com/xml/ns/persistence/orm}tab
le-generator>,<{http://java.sun.com/xml/ns/persistence/orm}persistence-unit-metadata>,<{ht
tp://java.sun.com/xml/ns/persistence/orm}entity>,<{http://java.sun.com/xml/ns/persistence/
orm}embeddable>,<{http://java.sun.com/xml/ns/persistence/orm}catalog>,<{http://java.sun.co
m/xml/ns/persistence/orm}named-native-query>,<{http://java.sun.com/xml/ns/persistence/orm}
sql-result-set-mapping>,<{http://java.sun.com/xml/ns/persistence/orm}schema>,<{http://java
.sun.com/xml/ns/persistence/orm}description>
org.apache.openejb.OpenEJBException: Cannot unmarshall the
openejb-cmp-orm.xml file: jar:f
ile:/E:/Softwares/apache-tomee-1.5.1-plus/apache-tomee-plus-1.5.1/apps/EntityBean.jar!/MET
A-INF/openejb-cmp-orm.xml: unexpected element
(uri:"http://java.sun.com/xml/ns/javaee", lo
cal:"entity"). Expected elements are
<{http://java.sun.com/xml/ns/persistence/orm}package>
,<{http://java.sun.com/xml/ns/persistence/orm}sequence-generator>,<{http://java.sun.com/xm
l/ns/persistence/orm}mapped-superclass>,<{http://java.sun.com/xml/ns/persistence/orm}named
-query>,<{http://java.sun.com/xml/ns/persistence/orm}access>,<{http://java.sun.com/xml/ns/
persistence/orm}table-generator>,<{http://java.sun.com/xml/ns/persistence/orm}persistence-
unit-metadata>,<{http://java.sun.com/xml/ns/persistence/orm}entity>,<{http://java.sun.com/
xml/ns/persistence/orm}embeddable>,<{http://java.sun.com/xml/ns/persistence/orm}catalog>,<
{http://java.sun.com/xml/ns/persistence/orm}named-native-query>,<{http://java.sun.com/xml/
ns/persistence/orm}sql-result-set-mapping>,<{http://java.sun.com/xml/ns/persistence/orm}sc
hema>,<{http://java.sun.com/xml/ns/persistence/orm}description>
        at
org.apache.openejb.config.ReadDescriptors.readCmpOrm(ReadDescriptors.java:473)
        at
org.apache.openejb.config.ReadDescriptors.deploy(ReadDescriptors.java:95)
        at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactor
y.java:338)
        at
org.apache.openejb.config.ConfigurationFactory.configureApplication(Configurati
onFactory.java:827)
        at
org.apache.openejb.config.ConfigurationFactory.configureApplication(Configurati
onFactory.java:674)
        at
org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(Configur
ationFactory.java:446)
        at
org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assemble
r.java:364)
        at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:343)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
        at
org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:233)
        at
org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:130)
        at
org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:121
)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j
ava:119)
        at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90
)
        at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)

        at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://java.sun.com
/xml/ns/javaee", local:"entity"). Expected elements are
<{http://java.sun.com/xml/ns/persi
stence/orm}package>,<{http://java.sun.com/xml/ns/persistence/orm}sequence-generator>,<{htt
p://java.sun.com/xml/ns/persistence/orm}mapped-superclass>,<{http://java.sun.com/xml/ns/pe
rsistence/orm}named-query>,<{http://java.sun.com/xml/ns/persistence/orm}access>,<{http://j
ava.sun.com/xml/ns/persistence/orm}table-generator>,<{http://java.sun.com/xml/ns/persisten
ce/orm}persistence-unit-metadata>,<{http://java.sun.com/xml/ns/persistence/orm}entity>,<{h
ttp://java.sun.com/xml/ns/persistence/orm}embeddable>,<{http://java.sun.com/xml/ns/persist
ence/orm}catalog>,<{http://java.sun.com/xml/ns/persistence/orm}named-native-query>,<{http:
//java.sun.com/xml/ns/persistence/orm}sql-result-set-mapping>,<{http://java.sun.com/xml/ns
/persistence/orm}schema>,<{http://java.sun.com/xml/ns/persistence/orm}description>
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unmar
shallingContext.java:662)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Lo
ader.java:120)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:105)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(Structure
Loader.java:262)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unm
arshallingContext.java:498)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unma
rshallingContext.java:480)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector
.java:150)
        at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
        at
org.apache.openejb.jee.JaxbJavaee$JavaeeNamespaceFilter.startElement(JaxbJavaee
.java:284)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source
)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher
.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Sour
ce)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unmarshall
erImpl.java:218)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshalle
rImpl.java:196)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshalle
rImpl.java:247)
        at
org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:132)
        at
org.apache.openejb.config.ReadDescriptors.readCmpOrm(ReadDescriptors.java:468)
        ... 24 more
Jan 9, 2013 10:04:20 AM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.system.apps=true'
------------------------------------------------------------------------------------------------------

1. openejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
             xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
             xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
             xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1">
  <enterprise-beans>
	<entity>
		<ejb-name>Emp</ejb-name>
		<jndi-name>EmpBean</jndi-name>
		<local-jndi-name>EmpBean</local-jndi-name>
		</entity>
  </enterprise-beans>
</openejb-jar>


2. persistence.xml :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name="cmp" transaction-type="JTA">
        <jta-data-source>RageDataSource</jta-data-source>
        <non-jta-data-source>RageNoTxDataSource</non-jta-data-source>
        <mapping-file>META-INF/*openejb-cmp-orm.xml*</mapping-file>
        <class>openejb.com.rage.EmpBean</class>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true, Indexes=false, IgnoreErrors=true)"/>
            <property name="openjpa.Log" value="DefaultLevel=trace"/>
          
        </properties>
    </persistence-unit>
</persistence>


3. openejb-cmp-orm.xml : This file I  have created from the generated file.
I  have renamed this file and 
                                    changed the persistent.xml as well.Also,
I have added my  mapping and    sequence.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
version="1.0">
    <entity class="openejb.com.rage.EmpBean" name="EmpBean">
        <description>EntityBean#Emp</description>
        

        <attributes>
            <id name="id">
                <column name="ID"/>
                <generated-value strategy="TABLE" generator="RD_SEQUENCE1"/>
            	<table-generator name="RD_SEQUENCE1"
table="RAGE_SEQUENCE_MASTER" pk-column-name="SEQUENCE_NAME"
                value-column-name="SEQUENCE_NUMBER"
pk-column-value="RD_SEQUENCE"/>
            </id>
            <basic name="name">
                <column name="name1"/>
            </basic>
            <basic name="des">
                <column name="des"/>
            </basic>
        </attributes>
    </entity>
</entity-mappings>

Thanks,
Bibhuti



--
View this message in context: http://openejb.979440.n4.nabble.com/Unmarshalling-error-when-I-rename-my-mapping-file-to-make-sure-at-runtime-this-mapping-is-referred-n-tp4660154p4660189.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message