Toplink XML: polymorphism/inheritance

Hi all,
I have an XML like this (I have replaced the real business names by A, B, C, X ,etc etc)
[root]
[collectionOfX]
[A/]
[A/]
[B/]
[C/]
[C/]
[C/]
[collectionOfX]
[root]
On the Java side, A, B and C are concrete classes extending an abstract class X. I have one root class with a collection of Xs.
I am not able to map this stuff. Toplink requires to have concrete X elements with an attribute telling that it is in fact a A [X xsi:type="A"] and not [A]
I have seen that substitution groups were a possible way for doing this, how does it work?
If you have any indication about how to do this stuff, it is very welcome. I have not found any example of this.

Ok Blaise, the example you provided me is working and I was able to apply the same principle to my project which is now working also.
I want to share the "tricks" that will make it work for anyone after me who could face the same problem again.
1. A, B and C must be defined as elements and these elements must be used as both schema context and default root element in the descriptor info pane of the corresponding A, B and C classes. In my case, A, B and C were complexTypes in the schema and it was not working.
2. The abstract X class was added to the project but its descriptor was de-activated (maybe not really necessary)
3. I have Mapped the Inherited Attributes for A, B, C concrete classes. It means the X attributes are now appearing in the A, B and C list of attributes in the workbench.
4. The mapping of all inherited attributes is repeated in the workbench for all concrete classes (a pain if there are many attributes).
Blaise, if possible I would like to find a better support for this case in future versions of the product. Ideally, the mapping of inherited attributes should be defined only once.
Thx.
Robin

Similar Messages

  • XML mapping inheritance problem; missing class indicator field

    Hi!
    I am currently working on a project which involves mapping a large domain model on a XSD schema. For this we use Toplink 10.1.3.1 which is mostly great. But now I have a problem while wanting to use class inheritance.
    In my XSD I have the following defined
    <xs:complexType name="Traject">
         <xs:sequence>
              <xs:element name="SoortTraject" type="SoortTraject"/>
         </xs:sequence>
    </xs:complexType>
    <xs:complexType name="SpecialTraject">
         <xs:complexContent>
              <xs:extension base="Traject">
                   <xs:sequence>
                                 [some elements] 
                   </xs:sequence>
              </xs:extension>
         </xs:complexContent>
    </xs:complexType>My XML is an implementation of this XSD and looks like this
    <Trajecten>
            <Traject xsi:type="SpecialTraject">
                     [implementation of the elements]
             </Traject>
    </Trajecten>My domain model corresponts to the XSD, so there is a Traject object and an inherited SpecialTraject object.
    In the mapping I used the Advanced properties->inheritance on both descriptors telling the Traject descriptor that it was the 'Root Parent Descriptor' ('Use class indicator field' -> 'use XML Schema Type attribute', 'Use class indicator dictionary') and the SpecialTraject what it Child Descriptor was ('Traject').
    When I test my mapping it always results in the same error (no matter how I configure this inheritance mapping). It says :
    [TOPLINK-44] missing class indicator field
    Descriptor: XMLDescriptor(Traject --> [])What am I doing wrong? Does anybody know a sollution?
    Best regards,
    Jouke Stoel
    Developer

    This is the changed XML descriptor file. When I deploy the file it automaticly overrides the old file so it ain't possible that I was still using the wrong file
    <toplink:class-indicator-mappings>
        <toplink:class-indicator-mapping>
            <toplink:class>Traject</toplink:class>
            <toplink:class-indicator xsi:type="xsd:string">Traject</toplink:class-indicator>
        </toplink:class-indicator-mapping>
        <toplink:class-indicator-mapping>
            <toplink:class>SpecialTraject</toplink:class>
            <toplink:class-indicator xsi:type="xsd:string">SpecialTraject</toplink:class-indicator>
        </toplink:class-indicator-mapping>
    </toplink:class-indicator-mappings>I have posted the stacktrace but I had to translate a bit because my exception was in Dutch :)
    Locale is a great invention
    Exception [TOPLINK-44] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DescriptorException
    Exception description: Missing class indicator field of database row [UnmarshalRecord()].
    Descriptor: XMLDescriptor(Traject --> [])
         at oracle.toplink.exceptions.DescriptorException.missingClassIndicatorField(DescriptorException.java:887)
         at oracle.toplink.internal.ox.QNameInheritancePolicy.classFromRow(QNameInheritancePolicy.java:84)
         at oracle.toplink.internal.ox.XMLRelationshipMappingNodeValue.processChild(XMLRelationshipMappingNodeValue.java:13)
         at oracle.toplink.internal.ox.XMLCompositeCollectionMappingNodeValue.startElement(XMLCompositeCollectionMappingNodeValue.java:62)
         at oracle.toplink.ox.record.UnmarshalRecord.startElement(UnmarshalRecord.java:352)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:205)
         at oracle.toplink.internal.ox.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:189)
         at oracle.toplink.internal.ox.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:147)
         at oracle.toplink.ox.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:228)
    .

  • NullPointerException for Toplink mappings to inherited attributes

    In the Toplink workbench (I´m using TP3) I need to map inherited attributes to the super class. Whenever I try this, my Toplink map goes corrupt with a NullPointer and is not usable any more.
    This is how it goes:
    - I have different common attributes (such as id, version, ...) stored in the super class
    - Create a new Toplink map
    - Choose "Add or Remove Descriptors"
    - Add the child class to be mapped
    - Choose "Map inherited attributes" -> "To Root Minus One"
    - Nothing happens: the additional super attributes don´t show up (??)
    - Restart JDev
    - Choose again "Map inherited attributes" -> "To Root Minus One"
    - Now the additional super attributes show up and you can do any mapping
    - Yet, if you restart JDev again and try to open the Toplink mapping you get the stacktrace shown below
    I checked this with Jdev 10.1.3 and the same classes and didn´t have any problems.
    Can you reproduce this?
    Thanx in advance
    Jens
    java.lang.NullPointerException
         at oracle.toplink.workbench.mappingsmodel.descriptor.MWDescriptor.packageName(MWDescriptor.java:214)
         at oracle.toplink.workbench.mappingsplugin.ui.project.ProjectNode.descriptorPackageNodeFor(ProjectNode.java:375)
         at oracle.toplink.workbench.mappingsplugin.ui.project.ProjectNode.addDescriptorNodeFor(ProjectNode.java:444)
         at oracle.toplink.workbench.mappingsplugin.ui.project.ProjectNode.addDescriptorNodesFor(ProjectNode.java:438)
         at oracle.toplink.workbench.mappingsplugin.ui.project.ProjectNode.engageValue(ProjectNode.java:268)
         at oracle.toplink.workbench.uitools.app.AbstractTreeNodeValueModel.addStateChangeListener(AbstractTreeNodeValueModel.java:70)
         at oracle.toplink.workbench.uitools.app.swing.TreeModelAdapter.engageNode(TreeModelAdapter.java:370)
         at oracle.toplink.workbench.uitools.app.swing.TreeModelAdapter.addChildren(TreeModelAdapter.java:354)
         at oracle.toplink.workbench.uitools.app.swing.TreeModelAdapter$ChangePolicy.addChildren(TreeModelAdapter.java:478)
         at oracle.toplink.workbench.uitools.app.swing.TreeModelAdapter$4.itemsAdded(TreeModelAdapter.java:177)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:76)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemsAdded(ChangeSupport.java:1140)
         at oracle.toplink.workbench.uitools.app.ValueModelChangeSupport.fireItemsAdded(ValueModelChangeSupport.java:242)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemsAdded(AbstractModel.java:373)
         at oracle.toplink.workbench.uitools.app.CollectionListValueModelAdapter.itemsAdded(CollectionListValueModelAdapter.java:305)
         at oracle.toplink.workbench.uitools.app.SortedListValueModelAdapter.itemsAdded(SortedListValueModelAdapter.java:99)
         at oracle.toplink.workbench.uitools.app.CollectionListValueModelAdapter$1.itemsAdded(CollectionListValueModelAdapter.java:97)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:55)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemsAdded(ChangeSupport.java:700)
         at oracle.toplink.workbench.uitools.app.ValueModelChangeSupport.fireItemsAdded(ValueModelChangeSupport.java:167)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemsAdded(AbstractModel.java:179)
         at oracle.toplink.workbench.uitools.app.ListCollectionValueModelAdapter.addInternalItems(ListCollectionValueModelAdapter.java:269)
         at oracle.toplink.workbench.uitools.app.ListCollectionValueModelAdapter.itemsAdded(ListCollectionValueModelAdapter.java:273)
         at oracle.toplink.workbench.uitools.app.ListCollectionValueModelAdapter$1.itemsAdded(ListCollectionValueModelAdapter.java:89)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:76)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemsAdded(ChangeSupport.java:1090)
         at oracle.toplink.workbench.uitools.app.ValueModelChangeSupport.fireItemsAdded(ValueModelChangeSupport.java:233)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemsAdded(AbstractModel.java:377)
         at oracle.toplink.workbench.uitools.app.ItemAspectListValueModelAdapter.itemsAdded(ItemAspectListValueModelAdapter.java:234)
         at oracle.toplink.workbench.uitools.app.ListValueModelWrapper$1.itemsAdded(ListValueModelWrapper.java:69)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:76)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemsAdded(ChangeSupport.java:1140)
         at oracle.toplink.workbench.uitools.app.ValueModelChangeSupport.fireItemsAdded(ValueModelChangeSupport.java:242)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemsAdded(AbstractModel.java:373)
         at oracle.toplink.workbench.uitools.app.CollectionListValueModelAdapter.itemsAdded(CollectionListValueModelAdapter.java:305)
         at oracle.toplink.workbench.uitools.app.CollectionListValueModelAdapter$1.itemsAdded(CollectionListValueModelAdapter.java:97)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:55)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemsAdded(ChangeSupport.java:650)
         at oracle.toplink.workbench.uitools.app.ValueModelChangeSupport.fireItemsAdded(ValueModelChangeSupport.java:158)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemsAdded(AbstractModel.java:183)
         at oracle.toplink.workbench.uitools.app.CollectionAspectAdapter.itemsAdded(CollectionAspectAdapter.java:264)
         at oracle.toplink.workbench.uitools.app.CollectionAspectAdapter$1.itemsAdded(CollectionAspectAdapter.java:117)
         at oracle.toplink.workbench.utility.events.DefaultChangeNotifier.itemsAdded(DefaultChangeNotifier.java:55)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemAdded(ChangeSupport.java:751)
         at oracle.toplink.workbench.utility.events.ChangeSupport.fireItemAdded(ChangeSupport.java:757)
         at oracle.toplink.workbench.utility.AbstractModel.fireItemAdded(AbstractModel.java:175)
         at oracle.toplink.workbench.utility.AbstractModel.addItemToCollection(AbstractModel.java:214)
         at oracle.toplink.workbench.framework.internal.FrameworkNodeManager.addProjectNode(FrameworkNodeManager.java:121)
         at oracle.toplink.workbench.addin.ui.view.TopLinkViewContext.initializeApplicationNodes(TopLinkViewContext.java:413)
         at oracle.toplink.workbench.addin.ui.view.TopLinkViewContext.initialize(TopLinkViewContext.java:391)
         at oracle.toplink.workbench.addin.ui.view.TopLinkViewContext.<init>(TopLinkViewContext.java:98)
         at oracle.toplink.workbench.addin.ui.view.TopLinkContextTopLinkViewContext.<init>(TopLinkContextTopLinkViewContext.java:64)
         at oracle.toplink.workbench.addin.ui.view.TopLinkContextViewContextBuilder.buildViewContext(TopLinkContextViewContextBuilder.java:84)
         at oracle.toplink.workbench.addin.ui.view.ViewContextManager.buildViewContext(ViewContextManager.java:361)
         at oracle.toplink.workbench.addin.ui.view.ViewContextManager.buildViewContext(ViewContextManager.java:343)
         at oracle.toplink.workbench.addin.ui.view.ViewContextManager.getViewContext(ViewContextManager.java:849)
         at oracle.toplink.workbench.addin.ui.view.TopLinkEditor.updateViewContext(TopLinkEditor.java:497)
         at oracle.toplink.workbench.addin.ui.view.TopLinkEditor.setContext(TopLinkEditor.java:371)
         at oracle.ideimpl.editor.EditorState.createEditor(EditorState.java:147)
         at oracle.ideimpl.editor.EditorState.getOrCreateEditor(EditorState.java:94)
         at oracle.ideimpl.editor.SplitPaneState.canSetEditorStatePos(SplitPaneState.java:231)
         at oracle.ideimpl.editor.SplitPaneState.setCurrentEditorStatePos(SplitPaneState.java:194)
         at oracle.ideimpl.editor.TabGroupState.createSplitPaneState(TabGroupState.java:103)
         at oracle.ideimpl.editor.TabGroup.addTabGroupState(TabGroup.java:355)
         at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1399)
         at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1333)
         at oracle.ideimpl.editor.EditorManagerImpl.openEditor(EditorManagerImpl.java:1259)
         at oracle.ideimpl.navigator.OpenEditorController.whenOpenEditor(OpenEditorController.java:41)
         at oracle.ideimpl.navigator.OpenEditorContextMenuListener.handleDefaultAction(OpenEditorContextMenuListener.java:51)
         at oracle.ide.controller.ContextMenuListenersHook$LazyContextMenuListener.handleDefaultAction(ContextMenuListenersHook.java:212)
         at oracle.ide.controller.ContextMenu.fireDefaultAction(ContextMenu.java:415)
         at oracle.ideimpl.explorer.BaseTreeExplorer.fireDefaultAction(BaseTreeExplorer.java:1770)
         at oracle.ideimpl.explorer.BaseTreeExplorer.dblClicked(BaseTreeExplorer.java:2105)
         at oracle.ideimpl.explorer.BaseTreeExplorer.mouseReleased(BaseTreeExplorer.java:2126)
         at oracle.ideimpl.explorer.CustomTree.processMouseEvent(CustomTree.java:195)
         at java.awt.Component.processEvent(Component.java:5282)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3984)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3819)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1791)
         at java.awt.Component.dispatchEvent(Component.java:3819)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Hi John,
    thanks for the reply.
    Thing is, we need to use JSF 1.2. So I guess, either we use 10g mappings in JDev/OC4J 11g or we try an alternative mapping with the 11g JDev/Workbench (e.g. using interfaces instead).
    For the first case I´ve found no suitable way: I´ve tried to remove the toplink.jars by using the "remove-inherited" tag in the application´s "orion-application.xml" file. This did not have the proper effect.
    For the second case, I´m wondering if the 11g TP3 mapping files are compatible to the next releases and to any EclipseLink releases.
    It would be very helpful if you could clarify these issues.
    Jens

  • Toplink xml binding session.xml and servlet

    I made a project with toplink-jaxb mapping
    with simple pojo object it works fine.
    I made another project with servlet
    and the same session.xml and java classes
    but when my process start it throw an exception :
    jaxbexception : Provider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated:
    It is like the process could not read the session.xml files, but this file and two xml file for the mapping are in the classpath (in WEB-INF/classes).
    Have i to put these files in another place ?
    Thanks.

    Hi,
    thank you for your response but
    here is the code :
    javax.xml.bind.JAXBContext jaxbContext = javax.xml.bind.JAXBContext.newInstance(
    "fr.cnav.cramse.pgpe.contactsnationaux"),this.getClass().getClassLoader());
    but i still got the same exception :
    05/03/01 08:24:33 exceptionProvider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated: java.lang.NoSuchMethodError: oracle.toplink.publicinterface.Session oracle.toplink.tools.sessionmanagement.SessionManager.getSession(oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader, java.lang.String, java.lang.ClassLoader, boolean, boolean)
    I have also a stange message in the log window in jdev :
    Cutting log (size: 101767, max: 100000)Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Cutting log (size: 101866, max: 100000)Error cleaning up log: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISeekableStream.seek]
    Thank you for your help.

  • Toplink XML mapping: mapping choice

    I am doing a proof of concept and we try to use Toplink mapping without changing the original XML Schema.
    We use Toplink 10.1.3.
    The XML contains a child element defined as a complexType with a <choice>of 3 elements of type A, B or C.
    Those 3 elements do have some common properties and we wanted to map them as a collection of concrete Java classes A, B & C extending a common Abstract Java class.
    Any clue how we can do that?
    Robin

    Ok, I understand.
    So basically, I replace the [choice] with A,B or C in my schema by a [sequence] where A, B or C are with minOccurs=0.
    In my case, I have a collection of these choices.
    [choice minOccurs="1" maxOccurs="unbounded"]
    The problem is that there is a list of A, B & C elements which are unsorted.
    [root]
    [some child elements]
    [a]
    [c]
    [a]
    and so on
    In the schema, the list of A, B & Cs is represented by a choice with maxOccurs="unbounded".
    I can't figure how to express that in TopLink, if ever it is possible to handle this case.
    Thanks for your help.
    Robin
    Message was edited by:
    mulkers: I have replaced XML elements brackets by [] because the forum message editor was dropping them

  • Workbench doesnt save or create toplink.xml

    Hello,
    i'm using the latest patch (9.0.4.8) and when i try to create the deployment xml for the current loaded toplink project no new <projekt>.xml file will be created.
    With the toplinkmw.jar from the 9.0.4.7 patch it works fine.
    Regards
    Dirk

    Hello Neil,
    no, i get no Exception or Error (or is there a error or log file which i've to check). What I'm wondering, with the 9.0.4.7 the workbench ask me to overwrite an existing file and tells me than that it has finished successfully. With the 9.0.4.8 it only ask for overwrite but never tells me that it has finished successfully.
    I will check my environment, because on another Client PC it works very well but there is an very newly TopLink installation only with the latest patch 9.0.4.8 an no oracle client.
    Maybe it is a misconfiguration in my environment.
    Regards
    Dirk

  • Toplink, XML and CLOB/NCLOB

    Hi
    New problem with Toplink;)
    We want to insert an XML into a NCLOB field in the database. The NCLOB field is mapped to a String field in my object model. Toplink generates and executes the SQL but the data is not inserted. When I cut and paste the SQL into TOAD it generates an "invalid character" message on the insert. Toplink gives no error message.
    We use toplink in a J2EE web-app and are therefor useing a thin jdbc driver. The toplink version is 9.0.4.
    Has anyone done anything like this?
    Thanks!

    Hi Bent,
    Could you please post the log with TopLink-generated SQL.
    Also I would try to determine whether it's "N" or "CLOB" that causes the problem.
    If you change NCLOB to NVARCHAR2 is the problem still there?
    If you change NCLOB to CLOB is the problem still there?
    This article describing LOB mapping in TopLink may be helpful, too:
    http://www.oracle.com/technology/products/ias/toplink/technical/tips/LOB/index.html

  • XML and inheritance

    According to David Carlson, �The current XML standards do not have a build-in mechanism for representing inheritance. A DTD cannot represent inheritance among element definitions.� From UMl application with XMl.
    Since XML doesnot have a standard way for inheritance, how know how do I know from XML this statement is inheritance. is there any new standard for inheritance by now?
    CODY

    In xml you dont explicitly define inheritance, it is inferred. The xml structure can be represented with a tree very easily.

  • XML Attribute "inheritance"

    I have a scenario where each Element in a node could be either "User" or "Machine" in scope, which I am defining with an attribute. Some nodes will be all one or the other scope, and some may have a mix of elements. Currently I am defining
    scope with an attribute on each and every element, which works, but with hundreds of elements to address, and many of them in single scope nodes, it would be nice if I could assign the attribute at the node level, and have all the elements in that node inherit.
    Ideally I could also discretely assign a scope to a single element while the rest inherit the node's scope.
    I know I could do this "manually" by getting the whole XML dataset, and then assigning Scope as I read each element, but if there is a way to get the effect I am looking for more elegantly using XPath I would prefer it. Ultimately the use here is
    a single script, that runs in either User or Machine context, and loads a list of tasks from XML. I am looking now at the part where I filter just the current scope's tasks.
    My current thinking is that a combined scope node would need to list both nodes, then I could filter nodes on appropriate scope and Elements on appropriate scope AND no scope. However, I don't think I can make this self validating with a Schema, right? A user
    could create a node and elements with no scope anywhere, so I am breaking one of the core features of XML. 
    Anyway, totally out of my element here, so hoping someone can point me in the right direction, both for XML data structure and for XPath syntax.
    The data might look like this
    <Node Scope="Machine, User">
       <Element Scope="Machine">Data</Element>
       <Element Scope="Machine">Data</Element>
       <Element Scope="User">Data</Element>
    </Node>
    <Node Scope="Machine">
       <Element>Data</Element>
       <Element>Data</Element>
       <Element>Data</Element>
    </Node>
    <Node Scope="User">
       <Element>Data</Element>
       <Element>Data</Element>
       <Element>Data</Element>
    </Node>
    Thanks!
    Gordon

    I don't think there's a way to make this happen automatically; the only feature of XML that I know of which behaves this way is namespaces. However, it's not too hard to write your own function which grabs the value from the node or its nearest parent. Something
    like this:
    function Get-XmlAttribute
    [CmdletBinding()]
    param (
    [Parameter(Mandatory = $true)]
    [System.Xml.XmlElement]
    $Node,
    [Parameter(Mandatory = $true)]
    [string]
    $Attribute
    $checkNode = $Node
    while ($checkNode -is [System.Xml.XmlElement])
    $string = $checkNode.GetAttribute($Attribute)
    if (-not [string]::IsNullOrEmpty($string))
    return $string
    $checkNode = $checkNode.ParentNode
    Note that because this function is using the .NET method GetAttribute(), the attribute name is case sensitive, just like in an XPath query.  Using this function, you could do something like this with your XML file:
    $xml = [xml](Get-Content test3.xml)
    $nodeList = $xml.SelectNodes('//Element')
    foreach ($node in $nodeList)
    $scope = Get-XmlAttribute -Node $node -Attribute Scope
    # Do something with $node and $scope

  • Toplink and Multiple inheritance

    Hi !
    If 'A' is my root descriptor, 'B' a child descriptor of 'A' and 'C', a child descriptor of 'B'.
    Do I absolutely need to define an indicator mapping for 'C' in 'A' ? Can I define an indicator mapping in a child descriptor for his own child descriptors.
    Thanks in advance,
    Christian Hebert

    No. You must configure the mappings at the root of the hierarchy. Your root table must provide some way to determine which subclass corresponds to a row anyways.
    Doug

  • Help on creating and deleting xml child elements using Toplink please.

    Hi there,
    I am trying to build a toplink xml demo illustrating toplink acting as the layer between my java code and an xml datasource.
    After pulling my custom schema into toplink and following the steps in http://www.oracle.com/technology/products/ias/toplink/preview/10.1.3dp3/howto/jaxb/index.htm related to
    Click on Mapping Workbench Project...Click on From XML Schema (JAXB)...
    I am able to set up java code which can run get and sets against my xml datasource. However, I want to also be able create and delete elements within the xml data for child elements.
    i.e. in a simple scenario I have a xsd for departments which has an unbounded element of type employee. How does toplink allow me to add and or remove employees in a department on the marshalled xml data source? Only gets and sets for the elements seem accessible.
    In my experience with database schema based toplink demos I have seen methods such as:
    public void setEmployeesCollection(Collection EmployeesCollection) {
         this.employeesCollection = employeesCollection;
    Is this functionality available for xml backended toplink projects?
    cheers
    Nick

    Hi Nick,
    Below I'll give an example of using the generated JAXB object model to remove and add a new node. The available APIs are defined in the JAXB spec. TopLink also supports mapping your own objects to XML, your own objects could contain more convenient APIs for adding or removing collection members
    Example Schema
    The following XML Schema will be used to generate a JAXB model.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="department">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="employee" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="employee">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>---
    Example Input
    The following document will be used as input. For the purpose of this example this XML document is saved in a file called "employee-data.xml".
    <department>
         <employee>
              <name>Anne</name>
         </employee>
         <employee>
              <name>Bob</name>
         </employee>
    </department>---
    Example Code
    The following code demonstrates how to use the JAXB APIs to remove the object representing the first employee node, and to add a new Employee (with name = "Carol").
    JAXBContext jaxbContext = JAXBContext.newInstance("your_context_path");
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    File file = new File("employee-data.xml");
    Department department = (Department) unmarshaller.unmarshal(file);
    // Remove the first employee in the list
    department.getEmployee().remove(0);
    // Add a new employee
    ObjectFactory objectFactory = new ObjectFactory();
    Employee newEmployee = objectFactory.createEmployee();
    newEmployee.setName("Carol");
    department.getEmployee().add(newEmployee);
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    marshaller.marshal(department, System.out);---
    Example Output
    The following is the result of running the example code.
    <department>
         <employee>
              <name>Bob</name>
         </employee>
         <employee>
              <name>Carol</name>
         </employee>
    </department>

  • Using TopLink with SCM

    Hi!
    I was working with my .mw file with OSCM source control instead of appear this error:
    "An unexpected error has occurred.We are sorry for the inconvenience.
    Messagge:
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
    Stack trace:
    Throwable Class Name:
    oracle.toplink.xml.XMLDataStoreException
    Message:
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
    Stack trace:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-13005] (TopLink - 9.0.3 (Build 423)): oracle.toplink.xml.XMLDataStoreException
    EXCEPTION DESCRIPTION: File already exists: [C:\Documents and Settings\mpedretti.DSI\Mis documentos\DocumentosToplink\Carpeta nueva\Table\Nueva 2.xml]
         at oracle.toplink.xml.XMLDataStoreException.fileAlreadyExists(Unknown Source)
         at oracle.toplink.xml.XMLFileStreamPolicy.getWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLFileStreamPolicy.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLFileAccessor.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLAccessorStreamPolicy.getNewWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLInsertCall.getWriteStream(Unknown Source)
         at oracle.toplink.xml.XMLWriteCall.execute(Unknown Source)
         at oracle.toplink.sdk.SDKAccessor.executeCall(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.executeNoSelectCalls(Unknown Source)
         at oracle.toplink.sdk.SDKQueryMechanism.insertObject(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown Source)
         at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown Source)
         at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknown Source)
         at oracle.toplink.publicinterface.UnitOfWork.commitAndResume(Unknown Source)
         at oracle.toplink.workbench.ui.BldrSession.saveProject(Unknown Source)
         at oracle.toplink.workbench.ui.BldrMainView.saveProject(Unknown Source)
         at oracle.toplink.workbench.ui.BldrMainView.saveSelectedProjects(Unknown Source)
         at oracle.toplink.workbench.ui.BldrActionManager$104.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    This happen when I tried to save the project. Any suggestion??
    What are the best practices to apply SCM using Toplink?
    Thanks!!
    Matias

    Whenever this happens you should be able to do a "file>save as" and save the project in a new directory -- at least you won't be loosing your work.
    Basically I think the problem is either that somehow you corrupted the project with checkin/checkout process, or you did not check out a file that the Mapping Workbench is trying to update when you save the project.
    10g Mapping Workbench, I have heard, is going to have more intelligence in the area and note ahead of time which files need to be checked out when you save your project. I think a developer preview will be available any day now, keep your eyes peeled to the OTN webpage for TopLink.
    The mapping workbench reference guide has a couple pages that talk about how to use it with SCM systems. In TopLink 903 these docs are shipped with TopLink. See page 1-11 for more info.

  • Problem to swap XML parser

    Hi all,
    I am trying to replace the official oracle XML library by apache xerces on a soa suite 10.1.3.1 developper hosted on a linux red hat platform.
    I have found a how to on oracle web site (http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html). I hadn't found any archive containing the source so I have buid a simple test using EJB 3 (In fact, I have created a "hello word" session bean that return a String containing the Dom builder factory class name).
    I have create the shared library using Entreprise manager as described in the how to.
    My test works fine if I deploy it with the default XML factory but if I add the following lines to the orion-application.xml, the deployment process ends with a null pointer exception :
    <imported-shared-libraries>
    <import-shared-library name="apache.xml" />
    <remove-inherited name="oracle.xml" />
    </imported-shared-libraries>
    I have tried to deploy the test using the entreprise manager web UI (as explain in how to) but the result was the same.
    I have tried to remove the "<remove-inherited name="oracle.xml" />" line but in this case, the XML parser still the oracle one.
    Do you know if the library specification is available in the last soa suite ?
    Thank in advance for your responses.
    Alexandre CUCUMEL
    PS: I can send the test code source if needed
    PS2: here is the complete opmn stack trace when I try to deploy the test application
    08/08/08 15:46:36 java.lang.RuntimeException: javax.xml.parsers.FactoryConfigurationError: Provider oracle.xml.jaxp.JXDocumentBuilderFactory could not
    be instantiated: java.lang.NullPointerException
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.Processor.runActions(Processor.java:105)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator$DeploymentCompileTool.run(DeploymentGenerator.java:205)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator.generateDeploymentArtifacts(DeploymentGenerator.java:131)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnotationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser.ja
    va:165)
    08/08/08 15:46:36 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    08/08/08 15:46:36 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    08/08/08 15:46:36 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    08/08/08 15:46:36 at java.lang.reflect.Method.invoke(Method.java:585)
    08/08/08 15:46:36 at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:85
    08/08/08 15:46:36 at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:201)
    08/08/08 15:46:36 at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:939)
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:832)
    08/08/08 15:46:36 at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
    08/08/08 15:46:36 at com.evermind.server.Application.setConfig(Application.java:413)
    08/08/08 15:46:36 at com.evermind.server.Application.setConfig(Application.java:314)
    08/08/08 15:46:36 at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    08/08/08 15:46:36 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    08/08/08 15:46:36 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    08/08/08 15:46:36 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    08/08/08 15:46:36 at java.lang.Thread.run(Thread.java:595)
    08/08/08 15:46:36 Caused by: javax.xml.parsers.FactoryConfigurationError: Provider oracle.xml.jaxp.JXDocumentBuilderFactory could not be instantiated:
    java.lang.NullPointerException
    08/08/08 15:46:36 at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:104)
    08/08/08 15:46:36 at oracle.j2ee.ws.wsdl.extensions.oracle.schema.SchemaSchemaElement.<init>(SchemaSchemaElement.java:37)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLTypeGenerator.generateSchema(WSDLTypeGenerator.java:435)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLTypeGenerator.processElement(WSDLTypeGenerator.java:735)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLTypeGenerator.processElementsInMessage(WSDLTypeGenerator.java:352)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLTypeGenerator.run(WSDLTypeGenerator.java:207)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLGenerator.generateTypes(WSDLGenerator.java:291)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLGenerator.generateDocument(WSDLGenerator.java:242)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLGenerator.doGeneration(WSDLGenerator.java:176)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLGenerator.doGeneration(WSDLGenerator.java:141)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.generator.wsdl.WSDLGenerator.perform(WSDLGenerator.java:126)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.processor.Processor.runActions(Processor.java:97)
    08/08/08 15:46:36 ... 23 more
    08/08/08 15:46:36 WARNING: Application.setConfig Application: testDeployement is in failed state as initialization failed.
    java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.NullPointerException
    08/08/08 15:46:36 oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: testDeployement is in failed state as i
    nitialization failed
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:515)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    08/08/08 15:46:36 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    08/08/08 15:46:36 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    08/08/08 15:46:36 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    08/08/08 15:46:36 at java.lang.Thread.run(Thread.java:595)
    08/08/08 15:46:36 Caused by: java.lang.InstantiationException: Application: testDeployement is in failed state as initialization failed
    08/08/08 15:46:36 at com.evermind.server.Application.setConfig(Application.java:471)
    08/08/08 15:46:36 at com.evermind.server.Application.setConfig(Application.java:314)
    08/08/08 15:46:36 at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
    08/08/08 15:46:36 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    08/08/08 15:46:36 ... 6 more
    08/08/08 15:46:36 Caused by: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.NullPointerException
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1064)
    08/08/08 15:46:36 at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
    08/08/08 15:46:36 at com.evermind.server.Application.setConfig(Application.java:413)
    08/08/08 15:46:36 ... 9 more
    08/08/08 15:46:36 Caused by: javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:365)
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:356)
    08/08/08 15:46:36 at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:92
    08/08/08 15:46:36 at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:201)
    08/08/08 15:46:36 at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:939)
    08/08/08 15:46:36 at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:832)
    08/08/08 15:46:36 ... 11 more
    08/08/08 15:46:36 Caused by: java.lang.NullPointerException
    08/08/08 15:46:36 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator.generateDeploymentArtifacts(DeploymentGenerator.java:138)
    08/08/08 15:46:36 at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnotationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser.ja
    va:165)
    08/08/08 15:46:36 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    08/08/08 15:46:36 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    08/08/08 15:46:36 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    08/08/08 15:46:36 at java.lang.reflect.Method.invoke(Method.java:585)
    08/08/08 15:46:36 at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:85
    08/08/08 15:46:36 ... 15 more
    08/08/08 15:46:36 WARNING: DeployerRunnable.run java.lang.InstantiationException: Application: testDeployement is in failed state as initialization fa
    iledoracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: testDeployement is in failed state as initialization
    failed
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.InstantiationException: Application: testDeployement is in failed state as initialization failed
    at com.evermind.server.Application.setConfig(Application.java:471)
    at com.evermind.server.Application.setConfig(Application.java:314)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    ... 4 more
    Caused by: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.NullPointerException
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1064)
    at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
    at com.evermind.server.Application.setConfig(Application.java:413)
    ... 9 more
    Caused by: javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:365)
    at com.evermind.server.ejb.EJBUtils.createEJBException(EJBUtils.java:356)
    at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:92)
    at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:201)
    at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
    at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:939)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:832)
    ... 11 more
    Caused by: java.lang.NullPointerException
    at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator.generateDeploymentArtifacts(DeploymentGenerator.java:138)
    at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnotationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser.java:165)
    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:585)
    at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:85)
    ... 15 more

    Andre,
    Thanks for your interest on my problem.
    In fact, I have created a test with just an interface and a class. No additional jars are added at compilation or ejb creation time.
    My java code is very simple (I have just copied the example main method and convert it to a SOAP method :
    package be.test;
    import javax.ejb.Stateless;
    import javax.jws.WebService;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    @Stateless
    @WebService(endpointInterface = "be.test.Test")
    public class TestImpl implements Test {
         public String test() {
              DocumentBuilder builder=null;
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              try
              builder = factory.newDocumentBuilder();
              return "<BR><B>DocumentBuilderFactory Instance:</B> " + factory.getClass().getName() +
              "<BR><B>DocumentBuilder Instance:</B> " + builder.getClass().getName() +"<BR>"; }
              catch (Exception e)
              return "Error processing DOM -- " + e.getMessage();
    Unfortunately, I think that the problem may come from EJB 3 stack that does not support an other XML library.
    Thanks again for your help.
    Best regards,
    Alexandre
    PS: appologies for the message formatting... I don't understand why the new line caracters are not corrects.

  • TopLink SessionBean Example Deploy Exception

    I am deploying the SessionBean Example which comes with TopLink installable in the examples folder on OC4J 9.0.4 standalone server. I have changed the datasource references for Db url and db driver in the DataSource.xml. Also added TopLink.jar and Xerces.jar in OC4J\j2ee\home\lib.
    Server StackTrace is :
    e:\oc4j903standalone\j2ee\home>java -jar oc4j.jar
    Oracle9iAS (9.0.4.0.0) Containers for J2EE initialized
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: EXCEP
    TION [TOPLINK-7094] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.Val
    idationException
    EXCEPTION DESCRIPTION: LOCAL EXCEPTION STACK:
    EXCEPTION DESCRIPTION: Several [2] SessionLoaderExceptions were thrown:
    EXCEPTION [TOPLINK-9005] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exception
    s.SessionLoaderException
    EXCEPTION DESCRIPTION: An exception was thrown while loading the <project-xml> f
    ile [EmployeeProject.xml].
    INTERNAL EXCEPTION: EXCEPTION [TOPLINK-13009] (TopLink - 9.0.3 (Build 423)): ora
    cle.toplink.xml.XMLDataStoreException
    EXCEPTION DESCRIPTION: ** Parsing error, line [1], uri [null] [The markup in
    the document preceding the root element must be well-formed.]
    EXCEPTION [TOPLINK-9001] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exception
    s.SessionLoaderException
    EXCEPTION DESCRIPTION: Unknown tag name: [session] in XML node: [toplink-configu
    ration].
    INTERNAL EXCEPTION: java.lang.reflect.InvocationTargetException
    TARGET INVOCATION EXCEPTION: java.lang.NullPointerException
    at oracle.toplink.exceptions.SessionLoaderException.finalException(Unkno
    wn Source)
    at oracle.toplink.tools.sessionconfiguration.XMLLoader.load(Unknown Sour
    ce)
    at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unkn
    own Source)
    at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unkn
    own Source)
    at examples.ejb.sessionbean.EmployeeSessionEJB.getSession(EmployeeSessio
    nEJB.java:183)
    at examples.ejb.sessionbean.EmployeeSessionEJB.createNewEmployee(Employe
    eSessionEJB.java:71)
    at EmployeeSession_StatelessSessionBeanWrapper0.createNewEmployee(Employ
    eeSession_StatelessSessionBeanWrapper0.java:90)
    at examples.ejb.sessionbean.CreateEmployee.doPost(CreateEmployee.java:53
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:763)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:308)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:779)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:264)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:107)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:484)
    SessionLoaderExceptions:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-9005] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exception
    s.SessionLoaderException
    EXCEPTION DESCRIPTION: An exception was thrown while loading the <project-xml> f
    ile [EmployeeProject.xml].
    INTERNAL EXCEPTION: EXCEPTION [TOPLINK-13009] (TopLink - 9.0.3 (Build 423)): ora
    cle.toplink.xml.XMLDataStoreException
    EXCEPTION DESCRIPTION: ** Parsing error, line [1], uri [null] [The markup in
    the document preceding the root element must be well-formed.]
    at oracle.toplink.exceptions.SessionLoaderException.failedToLoadProjectX
    ml(Unknown Source)
    at oracle.toplink.tools.sessionconfiguration.XMLLoader.process_project_x
    ml_Tag(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at oracle.toplink.tools.sessionconfiguration.XMLLoader.process_session_T
    ag(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at oracle.toplink.tools.sessionconfiguration.XMLLoader.processRootTag(Un
    known Source)
    at oracle.toplink.tools.sessionconfiguration.XMLLoader.load(Unknown Sour
    ce)
    at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unkn
    own Source)
    at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unkn
    own Source)
    at examples.ejb.sessionbean.EmployeeSessionEJB.getSession(EmployeeSessio
    nEJB.java:183)
    at examples.ejb.sessionbean.EmployeeSessionEJB.createNewEmployee(Employe
    eSessionEJB.java:71)
    at EmployeeSession_StatelessSessionBeanWrapper0.createNewEmployee(Employ
    eeSession_StatelessSessionBeanWrapper0.java:90)
    at examples.ejb.sessionbean.CreateEmployee.doPost(CreateEmployee.java:53
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:763)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:308)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:779)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:264)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:107)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:484)
    INTERNAL EXCEPTION STACK:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-13009] (TopLink - 9.0.3 (Build 423)): oracle.toplink.xml.XMLD
    ataStoreException
    EXCEPTION DESCRIPTION: ** Parsing error, line [1], uri [null] [The markup in
    the document preceding the root element must be well-formed.]
    at oracle.toplink.xml.XMLDataStoreException.parserError(Unknown Source)
    at oracle.toplink.xml.xerces.XMLToDatabaseRowTranslator.buildDocument(Un
    known Source)
    at oracle.toplink.xml.xerces.XMLToDatabaseRowTranslator.read(Unknown Sou
    rce)
    at oracle.toplink.xml.xerces.DefaultXMLTranslator.read(Unknown Source)
    at oracle.toplink.xml.XMLReadCall.execute(Unknown Source)
    at oracle.toplink.sdk.SDKAccessor.executeCall(Unknown Source)
    at oracle.toplink.publicinterface.Session.executeCall(Unknown Source)
    at oracle.toplink.sdk.SDKQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.sdk.SDKQueryMechanism.executeCall(Unknown Source)
    at oracle.toplink.sdk.SDKQueryMechanism.selectOneRow(Unknown Source)
    at oracle.toplink.queryframework.ReadObjectQuery.execute(Unknown Source)
    at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
    at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)

    I don't think it has to do with no dtd, but is a strange error. Have you tried oc4j 9.0.3?
    My only guess would be the extra blank line at the top of the EmployeeProject.xml (try removing this). Otherwise oc4j 9.0.4 may have a different version of xerces ahead of the one from toplink on the classpath. Try make sure that the toplink xerces is first or the only one on the classpath.

  • WL6.1 and Toplink 3.6.1

    I am having problems with connections not closing, we have a connection pool
    setup to our Sybase ASE 12.0 database using the jconnect driver.
    The connection pool maxes out at 50 connections but after those 50
    connections are gone, requests fail...
    Any Ideas?

    Hello,
    I am having same problem with weblogic6.1sp3 and toplink 903.
    I have one connection pool 'OraclePool'.
    I have two data sources added and refereing to that pool.
    My toplink.xml looks like this.
    <login>
    <datasource>oracleDataSource</datasource>
    <non-jts-datasource>oracleNonJTSDataSource</non-jts-datasource>
    </login>
    I have max capacity of 60 to that pool.
    When i run sql queries simultaneously server works ok, it uses all connections efficiently.
    But when i use update method using toplink, connections max out.
    And it says 'No connections available in the pool'.
    How can we find out if toplink closes connections efficiently
    after each transaction. Please let me know
    what is wrong with my setup.
    Thanks
    George

Maybe you are looking for