Advertisement

05.15.2006 at 11:07AM PDT, ID: 21851038
[x]
Attachment Details

java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException ... AbstractType in xmlbeans

Asked by meow00 in Java Programming Language, New to Java Programming

Hello experts,

   I am running an example from apache site, but wouldn't work ... could anyone please give me some help ? thanks.
  The original example is at:
  http://xmlbeans.apache.org/samples/AbstractTypes.html
  This example is regarding the AbstractType of xml beans ... does anyone ever deal with this ? Please HELP !!!
 
----------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
      at java.lang.Class.getMethod0(Unknown Source)
      at java.lang.Class.getMethod(Unknown Source)
      at org.apache.xmlbeans.XmlBeans.buildMethod(XmlBeans.java:174)
      at org.apache.xmlbeans.XmlBeans.buildNodeMethod(XmlBeans.java:195)
      at org.apache.xmlbeans.XmlBeans.buildNodeToCursorMethod(XmlBeans.java:232)
      at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:131)
      at abstractFigures.RootDocument$Factory.newInstance(Unknown Source)
      at org.apache.xmlbeans.samples.abstracttypes.AbstractTypes.buildDocument(AbstractTypes.java:37)
      at org.apache.xmlbeans.samples.abstracttypes.AbstractTypes.main(AbstractTypes.java:29)
---------------------------------------------------
   and the main java looks like:

  /*   Copyright 2004 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.apache.xmlbeans.samples.abstracttypes;

import abstractFigures.*;
import figures.*;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;

/**
 * Test class that builds a document using type substitution
 */
public class AbstractTypes
{
    public static void main(String[] args)
    {
        buildDocument(true);
    }

    public static XmlObject buildDocument(boolean enableOutput)
    {
        XmlOptions opt = (new XmlOptions()).setSavePrettyPrint();

        // Build a new document
        RootDocument doc = RootDocument.Factory.newInstance();
        RootDocument.Root figures = doc.addNewRoot();
        if (enableOutput)
            System.out.println("Empty document:\n" + doc.xmlText(opt) + "\n");

        // Add abstract figures
        Shape s1 = figures.addNewFigure();
        s1.setId("001");
        Shape s2 = figures.addNewFigure();
        s2.setId("002");
        // Document contains two shapes now
        // Because the shape is abstract, the document will not yet be valid
        if (enableOutput)
        {
            System.out.println("Document containing the abstract types:\n" + doc.xmlText(opt));
            System.out.println("Valid = " + doc.validate() + "\n");
        }

        // Change the abstract figures to concrete ones
        Circle circle = (Circle) s1.changeType(Circle.type);
        circle.setRadius(10.0);
        Square square = (Square) s2.changeType(Square.type);
        square.setSide(20.0);
        // Document contains two concrete shapes and is valid
        if (enableOutput)
        {
            System.out.println("Final document:\n" + doc.xmlText(opt));
            System.out.println("Vald = " + doc.validate());
        }Start Free Trial
[+][-]05.15.2006 at 11:24AM PDT, ID: 16684577

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, New to Java Programming
Sign Up Now!
Solution Provided By: hoomanv
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.15.2006 at 11:28AM PDT, ID: 16684610

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 11:33AM PDT, ID: 16684645

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 11:50AM PDT, ID: 16684765

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 12:07PM PDT, ID: 16684915

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 12:08PM PDT, ID: 16684922

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 12:13PM PDT, ID: 16684958

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 12:19PM PDT, ID: 16684999

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 02:06PM PDT, ID: 16685872

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32