Following tutorial1, I prepared an MsAccess database and a corresponding
class named com.spectrum.test.ColorBL and I put the ColorBL.java file
under <ojb-install-dir>\com\spectrum\test so that I classpath settings
be easy. I set thedbalias as, dbalias="colorojb".
 
ColorBL.java
package com.spectrum.test;
 
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.PersistenceBrokerFactory;
import org.apache.ojb.broker.util.ui.AsciiSplash;
import org.apache.ojb.broker.query.*;
 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.Vector;
 
public class ColorBL implements java.io.Serializable {
 
    private String colr_text = "";
    private String colr_name = "";
    private int colr_rate = 0;
    private String colr_rmrk = "";
    private String oid = "";
    /***********************/
    PersistenceBroker broker = null;
    /***********************/
 
    public ColorBL() {
    try
    {
        broker =
PersistenceBrokerFactory.createPersistenceBroker("repository.xml");
    }
    catch (Throwable t)
    {
        t.printStackTrace();
    }
 
    // useCases = new Vector();
    // useCases.add(new UCListallColors(broker));
    // useCases.add(new UCEnterNewProduct(broker));
    // useCases.add(new UCDeleteProduct(broker));
    // useCases.add(new UCQuitApplication(broker));
    }
    /***********************/
    public ColorBL(boolean isNew) {
    }
    /***********************/
    public String getDisplayString() {
        return this.colr_name + "(" + this.colr_text + ")";
    }
    /***********************/
    public void setColr_text(String value) {
        colr_text = value;
    }
    public String getColr_text() {
        return colr_text;
    }
 
    public void setColr_name(String value) {
        colr_name = value;
    }
    public String getColr_name() {
        return colr_name;
    }
 
    public void setColr_rate(int value) {
        colr_rate = value;
    }
    public int getColr_rate() {
        return colr_rate;
    }
 
    public void setColr_rmrk(String value) {
        colr_rmrk = value;
    }
    public String getColr_rmrk() {
        return colr_rmrk;
    }
    /***********************/
    public void setOid(String value) {
        oid = value;
    }
    /***********************/
    public String getOid() {
        return oid;
    }
    /***********************/
    public void apply()
    {
        System.out.println("The list of available colors:");
        // build a query that selects all objects of Class Product,
without any
        // further criteria according to ODMG the Collection containing
all
        // instances of a persistent class is called "Extent"
        Query query = new QueryByCriteria(ColorBL.class, null);
        try
        {
            // ask the broker to retrieve the Extent collection
            Collection allColors = broker.getCollectionByQuery(query);
            // now iterate over the result to print each product
            java.util.Iterator iter = allColors.iterator();
            while (iter.hasNext())
            {
                System.out.println(iter.next());
            }
        }
        catch (Throwable t)
        {
            t.printStackTrace();
        }
    }
    /***********************/
    public static void main(String []args){
        ColorBL colrBL = new ColorBL();
        colrBL.apply();
    }
    /***********************/
    /**
    public org.jdom.Element toXML()
    {
        java.util.HashMap hmProperty = new java.util.HashMap();
        hmProperty.put("oid", oid);
        hmProperty.put("colr_text", colr_text);
        hmProperty.put("colr_name", colr_name);
        hmProperty.put("colr_rmrk", colr_rmrk);
 
        return BLUtils.toXML("color", hmProperty);
    }
    */
    /***********************/
}
 
When I compile it reports ---
 
An exception has occurred in the compiler (1.3.1_02). Please file a bug
at th
java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi).
Include
our program and the following diagnostic in your report.  Thank you.
com.sun.tools.javac.v8.code.Symbol$CompletionFailure: file
javax\xml\parsers\
ParserConfigurationException.class not found
        at
com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:99
        at
com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:)
        at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:366)
        at
com.sun.tools.javac.v8.code.Type$ClassType.supertype(Type.java:812
        at
com.sun.tools.javac.v8.code.Symbol$ClassSymbol.isSubClass(Symbol.j:622)
        at com.sun.tools.javac.v8.comp.Check.isUnchecked(Check.java:541)
        at com.sun.tools.javac.v8.comp.Flow.markThrown(Flow.java:255)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:748)
        at com.sun.tools.javac.v8.tree.Tree$Apply.visit(Tree.java:785)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeExpr(Flow.java:339)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:766)
        at com.sun.tools.javac.v8.tree.Tree$Assign.visit(Tree.java:848)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeExpr(Flow.java:339)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:719)
        at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStat(Flow.java:394)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStats(Flow.java:413)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:520)
        at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStat(Flow.java:394)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:626)
        at com.sun.tools.javac.v8.tree.Tree$Try.visit(Tree.java:642)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStat(Flow.java:394)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStats(Flow.java:413)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:520)
        at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeStat(Flow.java:394)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:488)
        at
com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeDef(Flow.java:379)
        at com.sun.tools.javac.v8.comp.Flow._case(Flow.java:456)
        at
com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:402)
        at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:321)
        at com.sun.tools.javac.v8.comp.Flow.analyzeDef(Flow.java:379)
        at
com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:380)
        at com.sun.tools.javac.v8.Main.compile(Main.java:247)
        at com.sun.tools.javac.Main.main(Main.java:16)
 
Then I have xalan, xerces in my classpath and again compiled but the
same result is shown. What�s the problem?
 
====================================
Muhammad Ashikuzzaman
Programmer, Spectrum Engineering Consortium Ltd.
[EMAIL PROTECTED]
 


Reply via email to