Problems with JDO 2.1.3

I've been doing development with Kodo JDO 2.1.2 for a couple of weeks now,
and found it to be perfect for the application that I'm developing. When I
downloaded the 2.1.3 release on Friday, everything seemed to be OK. Now I
find that I can no longer compile my Java code (neither what I developed nor
the tutorials) - there seem to be missing classes in the libraries.
Specifically, the CLASSPATH variable is set by the 'jdocmd' batch file to
include the file '%JDODIR%/lib/jdoPFD.jar', which is not part of the
distribution, while the files '%JDODIR%/lib/jdbc2_0_stdext.jar' and
'%JDODIR%/lib/jdo_0_95.jar' (which are part of the distribution) are not put
in CLASSPATH.
I get the Java error message 'package javax.jdo does not exist' as the first
error in each compile, followed by several messages about being unable to
resolve symbols (such as PersistenceManager, Transaction, Query, et cetera).
When I added '%JDODIR%/lib/jdbc2_0_stdext.jar' and
'%JDODIR%/lib/jdo_0_95.jar' to CLASSPATH and removed
'%JDODIR%/lib/jdoPFD.jar', I still had the same errors.
I'm at a loss - if I could go back to JDO 2.1.2, I would, but I can't - it's
not on your download page and I didn't make a backup copy before downloading
JDO 2.1.3 (silly me).
I've attempted to contact Kodo with no luck at all - all the e-mail
addresses bounce, except for '[email protected]', which sends back a
message from '[email protected] on behalf of "RT::s?????????' stating
that is has 'No permission to create tickets in the queue ''." Is there a
problem at Kodo, or is this just a glitch?
Norm Jaffe, ATP Engineering Inc.

"Norman Jaffe" <[email protected]> writes:
Specifically, the CLASSPATH variable is set by the 'jdocmd' batch file to
include the file '%JDODIR%/lib/jdoPFD.jar', which is not part of the
distribution, while the files '%JDODIR%/lib/jdbc2_0_stdext.jar' and
'%JDODIR%/lib/jdo_0_95.jar' (which are part of the distribution) are not put
in CLASSPATH.Oops. jdo_0_95.jar should be named jdoPFD.jar. jdbc2_0_stdext.jar is
not strictly required -- it is only necessary if you are using a JDBC
2.0 database driver that does not include these classes in its
distribution.
When I added '%JDODIR%/lib/jdbc2_0_stdext.jar' and
'%JDODIR%/lib/jdo_0_95.jar' to CLASSPATH and removed
'%JDODIR%/lib/jdoPFD.jar', I still had the same errors.I'm surprised that your problems did not go away when you changed the
class path. How did you change it? Did you try editing jdocmd.bat
directly, and then opening a new shell?
I've attempted to contact Kodo with no luck at all - all the e-mail
addresses bounce, except for '[email protected]', which sends back a
message from '[email protected] on behalf of "RT::s?????????' stating
that is has 'No permission to create tickets in the queue ''." Is there a
problem at Kodo, or is this just a glitch?Again, oops. We recently moved our support server, and clearly we did
not set it up correctly. Sorry. It should be better now.
Norm Jaffe, ATP Engineering Inc.-Patrick Linskey

Similar Messages

  • I am having a problem with enhancing a .class for JDO

    Hi
    i am having a rpoblem with JDO . please help me for this.
    Buildfile: build.xml
    compile:
    xdoclet:
    [ojbdoclet] May 26, 2005 11:08:55 AM xdoclet.XDocletMain start
    [ojbdoclet] INFO: Running <ojbrepository/>
    [ojbdoclet] May 26, 2005 11:08:56 AM xdoclet.XDocletMain start
    [ojbdoclet] INFO: Running <torqueschema/>
    build:
    build_if_with_mainclass:
    enhance-jdori:
    [java] Enhancer: options:
    [java] verbose = true
    [java] quiet = false
    [java] forceWrite = true
    [java] noWrite = false
    [java] sourcePath = null
    [java] destinationDirectory = build/classes
    [java] propertiesFileName = null
    [java] doTiming = false
    [java] classNames = {
    [java] }
    [java] jdoFileNames = {
    [java] src/java/org/apache/ojb/tutorial5/Product.jdo
    [java] }
    [java] classFileNames = {
    [java] build/org/apache/ojb/tutorial5/Product.class
    [java] }
    [java] zipFileNames = {
    [java] }
    [java] dumpClass = false
    [java] noAugment = false
    [java] noAnnotate = false
    [java] JDO ENHANCER: using file: file:/D:/ojb-blank/ojb-blank/build/org/ap
    che/ojb/tutorial5/Product.class
    [java] Class Locator: using class files: {
    [java] build/org/apache/ojb/tutorial5/Product.class
    [java] }
    [java] JDO ENHANCER: using file: file:/D:/ojb-blank/ojb-blank/src/java/org
    apache/ojb/tutorial5/Product.jdo
    [java] -------------------------------------------------------------------
    [java] JDO ENHANCER: Enhancer: enhancing classfile ...
    [java] JDO ENHANCER: scanning class org.apache.ojb.tutorial5.Product
    [java] JDO ENHANCER: not found resource: META-INF/package.jdo
    [java] JDO ENHANCER: not found resource: WEB-INF/package.jdo
    [java] JDO ENHANCER: not found resource: package.jdo
    [java] JDO ENHANCER: not found resource: org/package.jdo
    [java] JDO ENHANCER: not found resource: org/apache/package.jdo
    [java] JDO ENHANCER: not found resource: org/apache/ojb/package.jdo
    [java] JDO ENHANCER: not found resource: org/apache/ojb/tutorial5/package.
    do
    [java] JDO ENHANCER: found resource: org/apache/ojb/tutorial5/Product.jdo
    [java] com.sun.jdori.enhancer.util.InternalError: assertion failed: cannot
    find class file for class: org/apache/ojb/tutorial5/Product
    [java] at com.sun.jdori.enhancer.util.Assertion.affirm(Unknown Source)
    [java] at com.sun.jdori.enhancer.meta.model.EnhancerMetaDataJDOModelIm
    l.declareField(Unknown Source)
    [java] at com.sun.jdori.enhancer.core.Analyzer.scanFields(Unknown Sour
    e)
    [java] at com.sun.jdori.enhancer.core.Analyzer.scan(Unknown Source)
    [java] at com.sun.jdori.enhancer.core.Controller.scan(Unknown Source)
    [java] at com.sun.jdori.enhancer.core.Controller.enhanceClass(Unknown
    ource)
    [java] at com.sun.jdori.enhancer.filter.Enhancer.enhanceClassFile1(Unk
    own Source)
    [java] at com.sun.jdori.enhancer.filter.Enhancer.enhanceClassFile(Unkn
    wn Source)
    [java] at com.sun.jdori.enhancer.Main.enhanceClassFile(Unknown Source)
    [java] at com.sun.jdori.enhancer.Main.enhanceInputFiles(Unknown Source
    [java] at com.sun.jdori.enhancer.Main.process(Unknown Source)
    [java] at com.sun.jdori.enhancer.Main.main(Unknown Source)
    [java] Fatal error while enhancing: JDO ENHANCER: An internal error occurr
    d while enhancing input class; detailed message: assertion failed: cannot find
    lass file for class: org/apache/ojb/tutorial5/Product
    [java] com.sun.jdori.enhancer.EnhancerFatalError: JDO ENHANCER: An interna
    error occurred while enhancing input class; detailed message: assertion failed
    cannot find class file for class: org/apache/ojb/tutorial5/Product
    [java] at com.sun.jdori.enhancer.filter.Enhancer.enhanceClassFile(Unkn
    wn Source)
    [java] at com.sun.jdori.enhancer.Main.enhanceClassFile(Unknown Source)
    [java] at com.sun.jdori.enhancer.Main.enhanceInputFiles(Unknown Source
    [java] at com.sun.jdori.enhancer.Main.process(Unknown Source)
    [java] at com.sun.jdori.enhancer.Main.main(Unknown Source)
    [java] aborted with errors.
    BUILD FAILED
    D:\ojb-blank\ojb-blank\build.xml:226: Java returned: 1
    Please help me asap
    bye
    Rahul S
    Senior Software Eng.
    Lionbridge Tech Pvt Ltd.

    Thanks for the suggestion. I have my iphone in an Otter Box and am not aware of getting any water in the phone. I tried cleaning out the docking opening with a toothbrush, no help. I will take your suggestion about going to Apple. Thanks again

  • Problems with Mapping Tool in Tutorial

    Hello,
    I am having problems with section 2.3 in the tutorial, even with the
    completed solutions of the tutorial. In particular, I cannot add Rabbit
    and Snake to the petshop. I get the following errors:
    C:\Apps\kodo-jdo-3.1.2\tutorial\solutions>javac *.java
    C:\Apps\kodo-jdo-3.1.2\tutorial\solutions>jdoc package.jdo
    578 INFO [main] kodo.Tool - JDO enhancer running on type "class
    tutorial.Animal".
    907 INFO [main] kodo.Tool - The class is already persistence capable -
    no enhancement performed.
    907 INFO [main] kodo.Tool - JDO enhancer running on type "class
    tutorial.Dog".
    907 INFO [main] kodo.Tool - The class is already persistence capable -
    no enhancement performed.
    907 INFO [main] kodo.Tool - JDO enhancer running on type "class
    tutorial.Rabbit".
    985 WARN [main] kodo.Enhance - Type "class tutorial.Rabbit" has no
    metadata; enhancing as persistence aware. If you intended for "class
    tutorial.Rabbit" to be persistence-capable, then this means that Kodo
    could not find any JDO metadata for "class tutorial.Rabbit". This can
    happen if the directory containing your metadata is not in your CLASSPATH,
    or if your JDO metadata files are not named in accordance with the JDO
    specification. See the Metadata Placement section of the Java Data Objects
    documentation distributed with Kodo JDO for more information.
    985 INFO [main] kodo.Tool - The class does not have JDO metadata -
    enhanced as persistence-aware.
    1063 INFO [main] kodo.Tool - JDO enhancer running on type "class
    tutorial.Snake".
    1094 WARN [main] kodo.Enhance - Type "class tutorial.Snake" has no
    metadata; enhancing as persistence aware. If you intended for "class
    tutorial.Snake" to be persistence-capable, then this means that Kodo could
    not find any JDO metadata for "class tutorial.Snake". This can happen if
    the directory containing your metadata is not in your CLASSPATH, or if
    your JDO metadata files are not named in accordance with the JDO
    specification. See the Metadata Placement section of the Java Data Objects
    do
    cumentation distributed with Kodo JDO for more information.
    1094 INFO [main] kodo.Tool - The class does not have JDO metadata -
    enhanced as persistence-aware.
    C:\Apps\kodo-jdo-3.1.2\tutorial\solutions>mappingtool -action refresh
    package.jdo
    3812 INFO [main] kodo.Tool - Mapping tool running on type "class
    tutorial.Animal" with action "refresh".
    4047 WARN [main] kodo.MetaData - There has been a change to the
    definition of "tutorial.Animal" or its schema since it was last mapped, or
    the mapping you defined is invalid: "The table "ANIMAL" specified in the
    mapping for type "tutorial.Animal" does not exist."
    4062 WARN [main] kodo.MetaData - There has been a change to the
    definition of "tutorial.Animal.<version-indicator>" or its schema since it
    was last mapped, or the mapping you defined is invalid: "The "column"
    attribute/extension for the version indicator on type
    "tutorial.Animal.<version-indicator>" is missing or names a column
    "JDOVERSION" that does not exist."
    4062 WARN [main] kodo.MetaData - There has been a change to the
    definition of "tutorial.Animal.<class-indicator>" or its schema since it
    was last mapped, or the mapping you defined is invalid: "The
    "class-column" attribute/extension for the class indicator on type
    "tutorial.Animal.<class-indicator>" is missing or names a column that does
    not exist."
    4062 WARN [main] kodo.MetaData - There has been a change to the
    definition of "tutorial.Animal.name" or its schema since it was last
    mapped, or the mapping you defined is invalid: "The "column"
    attribute/extension for field "tutorial.Animal.name" is missing or names a
    column "NAME0" in table "ANIMAL" that does not exist."
    4062 WARN [main] kodo.MetaData - There has been a change to the
    definition of "tutorial.Animal.price" or its schema since it was last
    mapped, or the mapping you defined is invalid: "The "column"
    attribute/extension for field "tutorial.Animal.price" is missing or names
    a column "PRICE" in table "ANIMAL" that does not exist."
    4078 INFO [main] kodo.Tool - Mapping tool running on type "class
    tutorial.Dog" with action "refresh".
    4078 INFO [main] kodo.Tool - Mapping tool running on type "class
    tutorial.Rabbit" with action "refresh".
    Exception in thread "main" kodo.meta.JDOMetaDataNotFoundException: No JDO
    metadata was found for type "class tutorial.Rabbit". Ensure that your JDO
    metadata files are accessible via resource lookup at runtime (typically
    this means they must be in your CLASSPATH), and that they are located in
    one of the JDO standard locations.
    at
    kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.java:131)
    at
    kodo.meta.DelegatingJDOMetaDataRepository.getMetaData(DelegatingJDOMetaDataRepository.java:123)
    at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:161)
    at kodo.jdbc.meta.MappingTool.refresh(MappingTool.java:576)
    at kodo.jdbc.meta.MappingTool.run(MappingTool.java:909)
    at kodo.jdbc.meta.MappingTool.run(MappingTool.java:850)
    at kodo.jdbc.meta.MappingTool.main(MappingTool.java:783)
    C:\Apps\kodo-jdo-3.1.2\tutorial\solutions>

    It sounds like your CLASSPATH is not set up correctly. Did you follow
    the instructions in the README for setting up your environment?

  • How to map M-N-O relationship with JDO

    Hi,
    I am relatively new to JDO so any help would be appreciated. I have a
    database that has 4 tabels, Item, Section, Mechanism and
    MechanismItemSection. MechanismItemSection is a mapping table between the
    rest of the three tables. It contains the primary keys of all the three
    tables(which makes the primary key for this table) and few more text
    fields. In order to map it to the JDO objects, i created 4 classes for
    each table and mapped the fields of the classes to the table.
    However, i am having problem with the MechanismItemSection table. The
    primary key of the table constitutes of three fields. How do i define an
    objectID for such a table? Is this the right way of doing it or there is a
    better way then this without having to change the schema for the database?
    Thanks in advance

    Dear Atif,
    In order to customize primary keys you will want to use application
    identity, whereby your application has complete control over the key
    values.
    A good overview of JDO identity types can be seen at:
    http://www.solarmetric.com/Software/Documentation/2.3.0/jdo_overview_pc_identity.html
    For example, in your case, you class might look like this (note that
    this code is not tested at all):
    public class MechanismItemSection
         public int myPK1;
         public short myPK2;
         public double myPK3;
         public String someStringField1;
         public String someStringField2;
         // ... etc ...
         // application identity class, implemented as an inner
         // class for convenience. Note that field names and types
         // must be public, and must match fields defined in the
         // MechanismItemSection class.
         public static final class Id
              public int myPK1;
              public short myPK2;
              public double myPK3;
              public Id ()
              public Id (String serialized)
                   StringTokenizer tok = new StringTokenizer (serialized, ":");
                   myPK1 = Integer.parseInt (tok.nextToken ());
                   myPK2 = Short.parseShort (tok.nextToken ());
                   myPK3 = Double.parseDouble (tok.nextToken ());
              public String toString ()
                   String serializeString = myPK1 + ":" + myPK2 + ":" + myPK3;
                   return serializeString;
              public int hashCode ()
                   return (int)(myPK1 + myPK2 + myPK3);
              public boolean equals (Object other)
                   Id otherId = (Id)other;
                   return otherId.myPK1 == myPK1
                   && otherId.myPK2 == myPK2
                        && otherId.myPK3 == myPK3;
    In article <[email protected]>, ...Atif... wrote:
    Hi,
    I am relatively new to JDO so any help would be appreciated. I have a
    database that has 4 tabels, Item, Section, Mechanism and
    MechanismItemSection. MechanismItemSection is a mapping table between the
    rest of the three tables. It contains the primary keys of all the three
    tables(which makes the primary key for this table) and few more text
    fields. In order to map it to the JDO objects, i created 4 classes for
    each table and mapped the fields of the classes to the table.
    However, i am having problem with the MechanismItemSection table. The
    primary key of the table constitutes of three fields. How do i define an
    objectID for such a table? Is this the right way of doing it or there is a
    better way then this without having to change the schema for the database?
    Thanks in advance
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code

  • Problem with mapping the Entity beans onto database tables

    Hi,
    I got a problem with mapping the Entity beans onto database tables. Here are what I did:
    First Step:
    asant capture-schema
    Second Step:
    capture-schema -driver com.pointbase.jdbc.jdbcUniversalDriver -dburl jdbc:pointbase:server://localhost/sun-appserv-samples -username pbPublic -password pbpublic -table APPLICANT -table APPLICANTSKILL -table CUSTOMER -table LOCATION -table job -table JOBSKILL -table SKILL -out build/agency.dbschema
    The first step was fine. But, in the second step, I got the error message as follow:
    using dburl:jdbc:pointbase:server://localhost/sun-appserv-samples
    using username:pbPublic
    using password:pbpublic
    using driver:com.pointbase.jdbc.jdbcUniversalDriver
    using schemaname:null
    using output file:build/agency.dbschema
    JDO71100: Failed to find a class. Verify that the class is available on your CLASSPATH
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co
    nnectionProvider.java:38)
    at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch
    ema.java:130)
    at com.sun.jdo.spi.persistence.support.ejb.util.CaptureSchemaWrapper.mai
    n(CaptureSchemaWrapper.java:29)
    Thanks for your help!

    You need to add the pbclient.jar or some similar name like that, in the CalssPath.

  • Problem with reverse mapping

    Hi!
    I am having a problem with reverse mapping. Here's what I do (copying the
    generated files to a correct directory omitted):
    % rd-schemagen -properties jdo.properties -file schema.xml
    % rd-reversemappingtool -properties jdo.properties -package testi
    schema.xml
    % javac -d build/classes src/testi/*.java
    % rd-importtool -properties jdo.properties src/testi/testi.mapping
    Here's a part of the output:
    <clip>
    2958 INFO [main] jdbc.Schema - Found existing table "Kirja" for schema
    "null".
    3002 INFO [main] jdbc.Schema - Found existing table "Kustantaja" for
    schema "n
    ull".
    3047 INFO [main] jdbc.SQL - [C: 5948361; T: 15336018]close
    3125 INFO [main] jdbc.SQL - [C: 2478770; T: 15336018]open:
    jdbc:mysql://localh
    ost/kirjakauppa (root)
    3129 INFO [main] jdbc.Schema - Found existing table "Kirjailija" for
    schema "n
    ull".
    3140 INFO [main] jdbc.SQL - [C: 2478770; T: 15336018]close
    3187 INFO [main] jdbc.SQL - [C: 7529545; T: 15336018]open:
    jdbc:mysql://localh
    ost/kirjakauppa (root)
    3193 INFO [main] jdbc.Schema - Found existing table "Kirjoittaja" for
    schema "
    null".
    3225 INFO [main] jdbc.SQL - [C: 7529545; T: 15336018]close
    Exception in thread "main" javax.jdo.JDOFatalInternalException:
    java.lang.Illega
    lArgumentException: You are attempting to link to a primary key column in
    table "Kirja" in a foreign key that is already linked to primary key
    columns in table "Kirjailija".
    NestedThrowables:
    java.lang.IllegalArgumentException: You are attempting to link to a primary
    key column in table "Kirja" in a foreign key that is already linked to
    primary key c
    olumns in table "Kirjailija".
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.Mappings.createClassMapping(Ma
    ppings.java:160)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMapping(M
    appingRepository.java:279)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMetaData(
    MappingRepository.java:147)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMapping(M
    appingRepository.java:158)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.getMapping(I
    mportTool.java:126)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.importMappin
    gs(ImportTool.java:57)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.run(ImportTo
    ol.java:408)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.main(ImportT
    ool.java:385)
    NestedThrowablesStackTrace:
    java.lang.IllegalArgumentException: You are attempting to link to a primary
    key column in table "Kirja" in a foreign key that is already linked to
    primary key c
    olumns in table "Kirjailija".
    at
    com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey.join(ForeignKey.j
    ava:238)
    at
    com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGenerator.generateFore
    ignKeys(SchemaGenerator.java:625)
    at
    com.solarmetric.rd.kodo.impl.jdbc.schema.DynamicSchemaFactory.findTab
    le(DynamicSchemaFactory.java:111)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.map.BaseClassMapping.fromMappi
    ngInfo(BaseClassMapping.java:113)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.Mappings.createClassMapping(Ma
    ppings.java:144)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMapping(M
    appingRepository.java:279)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMetaData(
    MappingRepository.java:147)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMapping(M
    appingRepository.java:158)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.getMapping(I
    mportTool.java:126)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.importMappin
    gs(ImportTool.java:57)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.run(ImportTo
    ol.java:408)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.main(ImportT
    ool.java:385)
    </clip>
    Here's what MySQLCC gives for creation statement of the tables:
    <clip>
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Asiakas'
    # CREATE TABLE `Asiakas` (
    `Asiakas_id` int(11) NOT NULL auto_increment,
    `Nimi1` varchar(50) default NULL,
    `Nimi2` varchar(50) default NULL,
    `KatuOsoite` varchar(50) default NULL,
    `Postiosoite` varchar(50) default NULL,
    `Email` varchar(50) default NULL,
    `Puhelin` varchar(50) default NULL,
    `Fax` varchar(50) default NULL,
    `Salasana` varchar(50) default NULL,
    `ExtranetTunnus` varchar(50) default NULL,
    PRIMARY KEY (`Asiakas_id`),
    KEY `Asiakas_id` (`Asiakas_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Kirja'
    # CREATE TABLE `Kirja` (
    `Kirja_id` int(11) NOT NULL auto_increment,
    `Kustantaja_id` int(11) default NULL,
    `Nimi` varchar(60) default NULL,
    `Nimi2` varchar(60) default NULL,
    `ISBN` varchar(50) default NULL,
    `Kieli` varchar(50) default NULL,
    `Kansi_URL` varchar(50) default NULL,
    `Sisalto_URL` varchar(50) default NULL,
    `Tukkuhinta` decimal(10,2) default NULL,
    `Kuluttajahinta` decimal(10,2) default NULL,
    `Varastokpl` int(11) default NULL,
    PRIMARY KEY (`Kirja_id`),
    KEY `Kirja_id` (`Kirja_id`),
    KEY `Kustantaja_id` (`Kustantaja_id`),
    FOREIGN KEY (`Kustantaja_id`) REFERENCES `kirjakauppa.Kustantaja`
    (`Kustantaja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Kirjailija'
    # CREATE TABLE `Kirjailija` (
    `Kirjailija_id` int(11) NOT NULL auto_increment,
    `Sukunimi` varchar(50) default NULL,
    `Etunimi` varchar(50) default NULL,
    `Maa` varchar(50) default NULL,
    `Kirjailija_URL` varchar(50) default NULL,
    PRIMARY KEY (`Kirjailija_id`),
    KEY `Kirjailija_id` (`Kirjailija_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Kirjoittaja'
    # CREATE TABLE `Kirjoittaja` (
    `Kirjoittaja_id` int(11) NOT NULL auto_increment,
    `Kirjailija_id` int(11) NOT NULL default '0',
    `Kirja_id` int(11) NOT NULL default '0',
    PRIMARY KEY (`Kirjoittaja_id`),
    KEY `Kirjailija_id` (`Kirjailija_id`),
    KEY `Kirja_id` (`Kirja_id`),
    FOREIGN KEY (`Kirjailija_id`) REFERENCES `kirjakauppa.Kirjailija`
    (`Kirjailija_id`),
    FOREIGN KEY (`Kirja_id`) REFERENCES `kirjakauppa.Kirja` (`Kirja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Koodi'
    # CREATE TABLE `Koodi` (
    `Koodi_id` int(11) NOT NULL auto_increment,
    `Koodi` varchar(50) default NULL,
    `Tyyppi` varchar(50) default NULL,
    `Arvo` varchar(50) default NULL,
    PRIMARY KEY (`Koodi_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Kustantaja'
    # CREATE TABLE `Kustantaja` (
    `Kustantaja_id` int(11) NOT NULL auto_increment,
    `Nimi` varchar(80) default NULL,
    `Maa` varchar(50) default NULL,
    `Kustantaja_URL` varchar(50) default NULL,
    `KirjaLkm` int(11) default NULL,
    PRIMARY KEY (`Kustantaja_id`),
    KEY `Kustantaja_id` (`Kustantaja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Luokittelu'
    # CREATE TABLE `Luokittelu` (
    `Luokittelu_id` int(11) NOT NULL auto_increment,
    `Luokka_id` int(11) NOT NULL default '0',
    `Kirja_id` int(11) NOT NULL default '0',
    PRIMARY KEY (`Luokittelu_id`),
    KEY `Luokka_id` (`Luokka_id`),
    KEY `Kirja_id` (`Kirja_id`),
    FOREIGN KEY (`Luokka_id`) REFERENCES `kirjakauppa.Luokka` (`Luokka_id`),
    FOREIGN KEY (`Kirja_id`) REFERENCES `kirjakauppa.Kirja` (`Kirja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Luokka'
    # CREATE TABLE `Luokka` (
    `Luokka_id` int(11) NOT NULL auto_increment,
    `Luokka` varchar(50) default NULL,
    PRIMARY KEY (`Luokka_id`),
    KEY `Luokka_id` (`Luokka_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Myyja'
    # CREATE TABLE `Myyja` (
    `Myyja_id` int(11) NOT NULL auto_increment,
    `Myyja` varchar(50) default NULL,
    `Myyja_URL` varchar(50) default NULL,
    PRIMARY KEY (`Myyja_id`),
    KEY `Myyja_id` (`Myyja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Tilaus'
    # CREATE TABLE `Tilaus` (
    `Tilaus_id` int(11) NOT NULL auto_increment,
    `Asiakas_id` int(11) NOT NULL default '0',
    `Myyja_id` int(11) default NULL,
    `TilausPvm` timestamp(14) NOT NULL,
    `EnsimmToimitusPvm` timestamp(14) NOT NULL,
    `ViimToimitusPvm` timestamp(14) NOT NULL,
    `Tila` int(11) NOT NULL default '0',
    `Mk` decimal(10,2) default NULL,
    PRIMARY KEY (`Tilaus_id`),
    KEY `Asiakas_id` (`Asiakas_id`),
    KEY `Myyja_id` (`Myyja_id`),
    KEY `Tilaus_id` (`Tilaus_id`),
    FOREIGN KEY (`Asiakas_id`) REFERENCES `kirjakauppa.Asiakas`
    (`Asiakas_id`),
    FOREIGN KEY (`Myyja_id`) REFERENCES `kirjakauppa.Myyja` (`Myyja_id`)
    ) TYPE=InnoDB;
    # Host: localhost
    # Database: kirjakauppa
    # Table: 'Tilausrivi'
    # CREATE TABLE `Tilausrivi` (
    `TilausRivi_id` int(11) NOT NULL auto_increment,
    `Tilaus_id` int(11) NOT NULL default '0',
    `Kirja_id` int(11) NOT NULL default '0',
    `TilausLkm` int(11) default NULL,
    `Ahinta` decimal(10,2) default NULL,
    `Alepros` float default NULL,
    `Mk` decimal(10,2) default NULL,
    `ToimitettuLkm` int(11) default NULL,
    `ToimitusPvm` timestamp(14) NOT NULL,
    `ViimToimitusPvm` timestamp(14) NOT NULL,
    `Tila` int(11) NOT NULL default '0',
    PRIMARY KEY (`TilausRivi_id`),
    KEY `Tilaus_id` (`Tilaus_id`),
    KEY `Kirja_id` (`Kirja_id`),
    FOREIGN KEY (`Tilaus_id`) REFERENCES `kirjakauppa.Tilaus` (`Tilaus_id`),
    FOREIGN KEY (`Kirja_id`) REFERENCES `kirjakauppa.Kirja` (`Kirja_id`)
    ) TYPE=InnoDB;
    </clip>
    I can find the original creation script if it is necessary.
    My guess was that I need to define the foreign keys myself into the
    generated schema.xml This is stated in the manual. However, this did not
    help, although it changed the stack trace a little (it complains about
    different classes than before):
    <clip>
    Exception in thread "main" javax.jdo.JDOFatalInternalException:
    java.lang.IllegalArgumentException: You are attempting to link to a primary
    key column in table "Myyja" in a foreign key that is already linked to
    primary key columns in table "Asiakas".
    NestedThrowables:
    java.lang.IllegalArgumentException: You are attempting to link to a primary
    key column in table "Myyja" in a foreign key that is already linked to
    primary key columns in table "Asiakas".
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.Mappings.createFieldMapping(Mappings.java:208)
    </clip>
    I don't think I fully understand the error message, what exactly is wrong
    here? How can I fix it?
    Here's a sample of the changes I made to schema.xml:
    - added the name - attribute to schema (it was missing)
    <schema name="kirjakauppa">
    - added the foreign key elements according to the table creation statements
    given above
    <fk name="Kustantaja_id" to-table="Kustantaja" column="Kustantaja_id"/>
         etc...
    -Antti

    On Mon, 16 Jun 2003 17:55:35 -0500, Abe White <[email protected]>
    wrote:
    It seems the last three options are being ignored - I still get a
    mapping
    file with schema names in front of tables (e.g. kirjakauppa.Asiakas, not
    Asiakas),That, unfortunately, is impossible to turn off. The -useSchemaName
    option controls whether the schema name is included as part of the
    generated class name; it doesn't affect the mapping data that is
    generated. What problems does including the schema name in the mapping
    data cause?
    rd-importtool -properties jdo.properties gensrc/testi/testi.mapping0 INFO [main] kodo.MetaData - Parsing metadata resource
    "file:/home/akaranta/work/kurssit/jdo/Harjoituskoodi/kirjakauppa/gensrc/testi/testi.mapping".
    Exception in thread "main"
    com.solarmetric.rd.kodo.meta.JDOMetaDataNotFoundException: No JDO metadata
    was found for type "class testi.Asiakas".
    FailedObject:class testi.Asiakas
    at
    com.solarmetric.rd.kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.java:126)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:184)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:197)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.getMapping(ImportTool.java:128)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.importMappings(ImportTool.java:60)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.run(ImportTool.java:400)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.main(ImportTool.java:377)
    This exception goes away if I edit the schema name out of the mapping
    file from all classes.
    separate classes are being generated for join tables with
    primary keysDo these join tables have an extra primary key column? TheYes, they do. Ok, now I know where the problem is.
    -primaryKeyOnJoin flag tells Kodo to ignore a join table with a primary
    key on the join columns. But Kodo can't handle join tables with extra
    column(s) just for a primary key identifier. This isn't a limitation of
    the reverse mapping tool, it's a limitation of Kodo. Kodo wouldn't know
    what to insert in those extra primary key column(s) when adding membersWhy not? If it can handle single numeric pk columns when making the
    generated classes use data store identity, it has to generate something to
    those columns. I can't see why this is different.
    That is simply out of curiosity - the next thing fixed my problem:
    to the join table. Of course, if the primary key is an auto-increment or
    something where Kodo can ignore it for inserts, you can just remove the
    <column> elements and the <pk> element from your .schema file and the
    reverse mapping tool will map it as a join table appropriately.It is auto-increment, so I did this and it worked. Thanks.
    , and application id is used for all classes.Are your primary keys on single, numeric columns? Kodo uses Java longsYes (int in MySQL), so that should not be a problem. They are also auto-
    incremented. This seems to be the only real problem remaining with this
    schema.
    -Antti

  • Problems with JUnit

    Hello,
    I'm using KODO 2.4.3 and JUnit 3.8.1 and log4j 1.2.8.
    I have a problem when executing TestCases with JUnit! I think it have to
    do with log4j.
    The Error is:
    javax.jdo.JDOFatalUserException: Exception thrown by
    getPersistenceManagerFactory(Properties)
    Caused by: org.apache.commons.logging.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
         at
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:416)
    I regret, but JUnit doesnt show the complete output of the eexception and
    you also can't copy and paste it! But it must have to do with the
    log4j-Framework (which makes alyways problems with JUnit?)...
    If I start JUnit without "-Dlog4j.ignoreTCL=true" then Errors occur with
    log4j already before KODO is called...
    Thanks for any idea.
    Best wishes
    BERND

    Bernd-
    Hmmm ... I really think that this problem is because you have another
    version of log4j somewhere in your CLASSPATH (or else the classpath that
    ant is using). Do you get this exception if you try to use the junit
    test cases stand-alone (by using the junit TestRunner class)?
    Can you scour your classpath and any classpath that is being used by
    ant to ensure that you do not have another log4j or commons-logging jar
    anywhere?
    In article <[email protected]>, Michael wrote:
    I'm using 1.2.8 so I doubt it's the version. It's possible to have two
    versions of the apache commons logging jar files, since they've renamed it
    from commons-logging to jakarta-commons-logging a while back.
    "Marc Prudhommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Bernd-
    Do you have a different version of log4j in your CLASSPATH (perhaps
    being used by ant)? You might want to try log4j 1.2.6, which does not
    exhibit any problems for us.
    In article <[email protected]>, Bernd Ruecker wrote:
    Yes, I have both...
    Michael wrote:
    Do you have both log4j & commons-logging jar files in your classpath??
    "Bernd Ruecker" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    I'm using KODO 2.4.3 and JUnit 3.8.1 and log4j 1.2.8.
    I have a problem when executing TestCases with JUnit! I think it have
    to
    do with log4j.
    The Error is:
    javax.jdo.JDOFatalUserException: Exception thrown by
    getPersistenceManagerFactory(Properties)
    Caused by: org.apache.commons.logging.LogConfigurationException:Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implementLog
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
    mpl.java:416)
    I regret, but JUnit doesnt show the complete output of the eexception
    and
    you also can't copy and paste it! But it must have to do with the
    log4j-Framework (which makes alyways problems with JUnit?)...
    If I start JUnit without "-Dlog4j.ignoreTCL=true" then Errors occurwith
    log4j already before KODO is called...
    Thanks for any idea.
    Best wishes
    BERND
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Problem with WSAD plugin

    I have a problem with the websphere studio v5.1.1 (eclipse) plugin.
    I've set up the plugin as explained in the doc. I've added the db2java.zip
    file with the other kodo libs for the db2 driver and added the following
    line in plugin.xml :
    <library name="db2java.zip"/>
    In the preference/kodo I've just filed the "kodo properties file" area
    with the name of my kodo.properties file. All other fields are empty
    The kodo.properties file contains (amongst other things):
    javax.jdo.PersistenceManagerFactoryClass=kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=COM.ibm.db2.jdbc.app.DB2Driver
    javax.jdo.option.ConnectionUserName=wasdev
    javax.jdo.option.ConnectionPassword=<pwd>
    javax.jdo.option.ConnectionURL=jdbc:db2:cluster
    kodo.jdbc.sql.DBDictionary=db2
    Now the problem. From WSAD, menu Kodo
    - menu "enhance metadata" works well
    - menus "refresh mapping", "drop mappings" and "build schema" give the
    following error: "kodo.util.FatalDataStoreException: No suitable driver"
    Note that the mappingtool works perfectly well with the same
    kodo.properties file and on the same package.jdo file outside WSAD.
    It seems that it finds the class "COM.ibm.db2.jdbc.app.DB2Driver" from
    db2java.zip, but is not able to map the url "jdbc:db2:cluster" to this
    driver.
    Context:
    - WSAD 5.1.1
    - DB2 7.2 FP11
    - kodo evaluation v 3.1.0
    - Windows XP FP1
    Thanks for your help.
    Part of the Traceback from eclipse logs:
    !java.sql.SQLException: No suitable driver
         at java.lang.Throwable.<init>(Throwable.java)
         at java.lang.Throwable.<init>(Throwable.java)
         at java.sql.SQLException.<init>(SQLException.java:72)
         at java.sql.DriverManager.getDriver(DriverManager.java:266)
         at
    com.solarmetric.jdbc.PoolingDataSource.getDriver(PoolingDataSource.java:271)
         at
    com.solarmetric.jdbc.PoolingDataSource.newConnection(PoolingDataSource.java:313)
         at
    com.solarmetric.jdbc.ConnectionPoolImpl.makeConnection(ConnectionPoolImpl.java:270)
         at
    com.solarmetric.jdbc.ConnectionPoolImpl.getConnection(ConnectionPoolImpl.java:178)
         at
    com.solarmetric.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:237)
         at
    com.solarmetric.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:130)
         at
    com.solarmetric.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:81)
         at
    com.solarmetric.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:130)
         at
    kodo.jdbc.schema.DataSourceFactory$DefaultsDataSource.getConnection(DataSourceFactory.java:295)
         at
    kodo.jdbc.sql.DBDictionaryFactory.getDBDictionary(DBDictionaryFactory.java:56)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:627)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:877)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:967)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCConfigurationImpl.java:976)
         at kodo.jdbc.schema.SchemaTool.<init>(SchemaTool.java:78)
         at kodo.jdbc.meta.MappingTool.newSchemaTool(MappingTool.java:269)
         at kodo.jdbc.meta.MappingTool.getSchemaTool(MappingTool.java:259)
         at kodo.jdbc.meta.MappingTool.run(MappingTool.java:898)

    I changed for the net driver and it works. (Can not use jcc, as jcc driver
    is for DB2 8.1 and I'm using DB2 7.2)
    Thanks Kim!
    However it sounds strange that the mapping tools used outside WSAD
    recognize the db2 "app" type 2 driver format, and fail when they are use
    inside WSAD as plugins... Should it be reported as a bug with the usage of
    the "net" driver as workaround ?
    Stephen Kim wrote:
    First, I'd suggest trying the net (instead of app) or jcc driver.
    Second, I would try pointing kodo.properties to a specific file.
    Denis Forveille wrote:
    I have a problem with the websphere studio v5.1.1 (eclipse) plugin.
    I've set up the plugin as explained in the doc. I've added the db2java.zip
    file with the other kodo libs for the db2 driver and added the following
    line in plugin.xml :
    <library name="db2java.zip"/>
    In the preference/kodo I've just filed the "kodo properties file" area
    with the name of my kodo.properties file. All other fields are empty
    The kodo.properties file contains (amongst other things):
    javax.jdo.PersistenceManagerFactoryClass=kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=COM.ibm.db2.jdbc.app.DB2Driver
    javax.jdo.option.ConnectionUserName=wasdev
    javax.jdo.option.ConnectionPassword=<pwd>
    javax.jdo.option.ConnectionURL=jdbc:db2:cluster
    kodo.jdbc.sql.DBDictionary=db2
    Now the problem. From WSAD, menu Kodo
    - menu "enhance metadata" works well
    - menus "refresh mapping", "drop mappings" and "build schema" give the
    following error: "kodo.util.FatalDataStoreException: No suitable driver"
    Note that the mappingtool works perfectly well with the same
    kodo.properties file and on the same package.jdo file outside WSAD.
    It seems that it finds the class "COM.ibm.db2.jdbc.app.DB2Driver" from
    db2java.zip, but is not able to map the url "jdbc:db2:cluster" to this
    driver.
    Context:
    - WSAD 5.1.1
    - DB2 7.2 FP11
    - kodo evaluation v 3.1.0
    - Windows XP FP1
    Thanks for your help.
    Part of the Traceback from eclipse logs:
    !java.sql.SQLException: No suitable driver
         at java.lang.Throwable.<init>(Throwable.java)
         at java.lang.Throwable.<init>(Throwable.java)
         at java.sql.SQLException.<init>(SQLException.java:72)
         at java.sql.DriverManager.getDriver(DriverManager.java:266)
         at
    com.solarmetric.jdbc.PoolingDataSource.getDriver(PoolingDataSource.java:271)
         at
    com.solarmetric.jdbc.PoolingDataSource.newConnection(PoolingDataSource.java:313)
         at
    com.solarmetric.jdbc.ConnectionPoolImpl.makeConnection(ConnectionPoolImpl.java:270)
         at
    com.solarmetric.jdbc.ConnectionPoolImpl.getConnection(ConnectionPoolImpl.java:178)
         at
    com.solarmetric.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:237)
         at
    com.solarmetric.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:130)
         at
    com.solarmetric.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:81)
         at
    com.solarmetric.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:130)
         at
    kodo.jdbc.schema.DataSourceFactory$DefaultsDataSource.getConnection(DataSourceFactory.java:295)
         at
    kodo.jdbc.sql.DBDictionaryFactory.getDBDictionary(DBDictionaryFactory.java:56)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:627)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:877)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:967)
         at
    kodo.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCConfigurationImpl.java:976)
         at kodo.jdbc.schema.SchemaTool.<init>(SchemaTool.java:78)
         at kodo.jdbc.meta.MappingTool.newSchemaTool(MappingTool.java:269)
         at kodo.jdbc.meta.MappingTool.getSchemaTool(MappingTool.java:259)
         at kodo.jdbc.meta.MappingTool.run(MappingTool.java:898)
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Problems with Log4j/commonslogging

    I'm having some weird problems with log4j or commons/logging. I'm not at all
    excluding that they may be my own fault, but I can't get to the actual
    problem. Hope someone can help me out. I'm getting an exception at startup
    of the VM. The exception is below. The problem seems to be version related I
    think, but I can't figure it out exactly, since the versions of both logging
    and log4j I have in my path seem to be exactly equal to those in my 2.5 RC1
    distrib.
    Hope you can help out,
    Martin van Dijken
    PS: This isn't the entire excep, hope it's enough
    1652 ERROR [main] kodo.Runtime -
    org.apache.commons.logging.LogConfigurationException:
    org.apache.commons.logging.LogConfigurationException:org.apache.commons.logg
    ing.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
    org.apache.commons.logging.LogConfigurationException:
    org.apache.commons.logging.LogConfigurationException:org.apache.commons.logg
    ing.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
    at
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
    va:555)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
    va:289)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:409)
    at
    com.solarmetric.modules.tools.compiler.MetaDataParser.<init>(MetaDataParser.
    java:32)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.<init>(CFMetaDataPar
    ser.java:39)
    at
    com.solarmetric.kodo.meta.JDOMetaDataParser.<init>(JDOMetaDataParser.java:61
    at
    com.solarmetric.kodo.meta.ClassMetaData.getInstance(ClassMetaData.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.registerClassIn
    ternal(JDBCPersistenceManagerFactory.java:444)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.registerClass(J
    DBCPersistenceManagerFactory.java:334)
    at
    com.solarmetric.kodo.impl.jdbc.RegisterListener.registerClass(RegisterListen
    er.java:53)
    at javax.jdo.spi.JDOImplHelper.registerClass(JDOImplHelper.java:269)
    at
    com.madocke.mirakel.forum.ForumMessage.<clinit>(ForumMessage.java)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at
    com.solarmetric.kodo.util.MultiLoaderClassResolver.resolveClass(MultiLoaderC
    lassResolver.java:85)
    at
    com.solarmetric.kodo.util.MultiLoaderClassResolver.canResolveClass(MultiLoad
    erClassResolver.java:143)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:231)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:180)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:165)
    at
    com.solarmetric.kodo.meta.JDOMetaDataParser.startClass(JDOMetaDataParser.jav
    a:122)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.startElement(CFMetaD
    ataParser.java:53)
    at
    com.solarmetric.modules.tools.compiler.MetaDataParser.startElement(MetaDataP
    arser.java:238)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
    Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
    Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
    wn Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
    her.dispatch(Unknown Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
    Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

    What is probably happening is a class loader issue... I would put
    jakarta's logging jar in the same place as log4j and be sure that they
    aren't extraneously in the classpath (such as in an EAR or WAR). Java
    can be pretty funky about classloaders and interfaces.
    On Fri, 16 May 2003 11:02:40 -0400, Alex Roytman wrote:
    Are you running it standalone or under lets say tomcat 4?
    "Martin van Dijken" <[email protected]> wrote in message
    news:[email protected]...
    I'm having some weird problems with log4j or commons/logging. I'm not atall
    excluding that they may be my own fault, but I can't get to the actual
    problem. Hope someone can help me out. I'm getting an exception at startup
    of the VM. The exception is below. The problem seems to be version relatedI
    think, but I can't figure it out exactly, since the versions of bothlogging
    and log4j I have in my path seem to be exactly equal to those in my 2.5RC1
    distrib.
    Hope you can help out,
    Martin van Dijken
    PS: This isn't the entire excep, hope it's enough
    1652 ERROR [main] kodo.Runtime -
    org.apache.commons.logging.LogConfigurationException:
    org.apache.commons.logging.LogConfigurationException:org.apache.commons.logg
    ing.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
    org.apache.commons.logging.LogConfigurationException:
    org.apache.commons.logging.LogConfigurationException:org.apache.commons.logg
    ing.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
    at
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
    va:555)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
    va:289)
    atorg.apache.commons.logging.LogFactory.getLog(LogFactory.java:409)
    at
    com.solarmetric.modules.tools.compiler.MetaDataParser.<init>(MetaDataParser.
    java:32)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.<init>(CFMetaDataPar
    ser.java:39)
    at
    com.solarmetric.kodo.meta.JDOMetaDataParser.<init>(JDOMetaDataParser.java:61
    at
    com.solarmetric.kodo.meta.ClassMetaData.getInstance(ClassMetaData.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.registerClassIn
    ternal(JDBCPersistenceManagerFactory.java:444)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.registerClass(J
    DBCPersistenceManagerFactory.java:334)
    at
    com.solarmetric.kodo.impl.jdbc.RegisterListener.registerClass(RegisterListen
    er.java:53)
    atjavax.jdo.spi.JDOImplHelper.registerClass(JDOImplHelper.java:269)
    at
    com.madocke.mirakel.forum.ForumMessage.<clinit>(ForumMessage.java)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at
    com.solarmetric.kodo.util.MultiLoaderClassResolver.resolveClass(MultiLoaderC
    lassResolver.java:85)
    at
    com.solarmetric.kodo.util.MultiLoaderClassResolver.canResolveClass(MultiLoad
    erClassResolver.java:143)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:231)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:180)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.classForName(CFMetaD
    ataParser.java:165)
    at
    com.solarmetric.kodo.meta.JDOMetaDataParser.startClass(JDOMetaDataParser.jav
    a:122)
    at
    com.solarmetric.modules.tools.compiler.CFMetaDataParser.startElement(CFMetaD
    ataParser.java:53)
    at
    com.solarmetric.modules.tools.compiler.MetaDataParser.startElement(MetaDataP
    arser.java:238)
    atorg.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
    Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
    Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
    wn Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
    her.dispatch(Unknown Source)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
    Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(UnknownSource)
    at org.apache.xerces.parsers.DTDConfiguration.parse(UnknownSource)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(UnknownSource)
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Problems with generating persistent classes

    I've been following the tutorial for generating persistent classes from a
    DB. I'm not having much luck:
    First, with rd-schemagen, how do you tell it to only work on a specific
    schema? I run "rd-schemagen -file schema.xml NBS_ODS_101", but it still
    generates the schema file for all schemas in the DB. Is there a usage
    option for the tool (I haven't been able to find it yet)?
    Second, I have the following tables in my DB: ACT, ACT_ID, ENTITY,
    ENTITY_ID. When rd-reversemappingtool runs on these tables, it creates an
    ID class for ACT (ActId) which conflicts with the class generated for
    ACT_ID (ActId). Since renaming the tables is not an option and I really
    don't want to have to rename classes and change the mapping file every
    time I regenerate, what is a solution for this problem?
    Third, if I do the latter above so I can run the importtool and then I
    run "rd-importtool test\test.mapping", it runs successfully for a bit
    while spitting out information until I get this:
    Exception in thread "main" java.lang.NullPointerException
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.mapForeignKe
    y(ImportTool.java:336)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.mapField(Imp
    ortTool.java:207)
    at
    com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.importMappin
    gs(ImportTool.java:78)
    at com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.run
    (ImportTo
    ol.java:408)
    at com.solarmetric.rd.kodo.impl.jdbc.meta.compat.ImportTool.main
    (ImportT
    ool.java:385)

    Abe White <[email protected]> wrote in
    news:[email protected]:
    First, with rd-schemagen, how do you tell it to only work on a specific
    schema? I run "rd-schemagen -file schema.xml NBS_ODS_101", but it still
    generates the schema file for all schemas in the DB. Is there a usage
    option for the tool (I haven't been able to find it yet)?Try using -schemas <comma-separated list of schema names>
    I apologize for the documentation in this area. We're going to upgrade
    the tool and the documentation to a more recent version from our internal
    R&D codebase when our 2.5 release comes out in the next couple of weeks.
    This release will also include a system for customizing the tool's output
    in many more ways.This works:
    rd-schemagen -file schema.xml -indexes false -schemas NBS_ODS_101
    but this does not:
    rd-schemagen -file schema.xml -indexes false -schemas NBS_ODS_101,NBS_SRT_
    101
    Exception in thread "main" java.lang.IllegalArgumentException:
    com.solarmetric.r
    [email protected] = NBS_ODS_
    101,NBS_SRT_10
    1: java.lang.ArrayIndexOutOfBoundsException: 1
    at serp.util.Options.setInto(Options.java:206)
    at serp.util.Options.setInto(Options.java:168)
    at com.solarmetric.rd.conf.Configurations.populateConfiguration
    (Configur
    ations.java:144)
    at com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGenerator.main
    (SchemaG
    enerator.java:690)
    Second, I have the following tables in my DB: ACT, ACT_ID, ENTITY,
    ENTITY_ID. When rd-reversemappingtool runs on these tables, it creates
    an ID class for ACT (ActId) which conflicts with the class generated for
    ACT_ID (ActId)This is a bug, and will also be fixed with 2.5. I can't even think of a
    good way to tell you to work around it for now, unfortunately.I renamed the ID classes to ActOid and EntityOid and changed the .jdo file
    to reflect that. Do you see any problems with this strategy?
    Third, if I do the latter above so I can run the importtool and then I
    run "rd-importtool test\test.mapping", it runs successfully for a bit
    while spitting out information until I get this:
    Exception in thread "main" java.lang.NullPointerExceptionCan you please send the generated .mapping, .jdo, and .java files?
    Unless you want to wait until the 2.5 improvements to debug.I will send you all the files in a zip file by email.

  • Locking problem with Postgresql

    I'm having some intermittent deadlock problems with Postgresql (7.1 and
    7.2) and Kodo 2.2.3 and 2.2.4.
    It appears to be a conflict between my JDO and my JDBC code. I reduced
    the problem section to the
    method found below.
    I am running 10 threads concurrently in this test script. Each thread
    is calling the "runQuery()" method
    below which creates a PersistenceManager, starts a transaction, runs an
    unrelated JDBC query, and
    then commits the transaction.
    The transaction is unrelated to the JDBC query, but it seems to
    interfere with it. After a random number
    of transactions, it locks up. Now that I've upgraded to 7.2 and 2.2.4,
    it doesn't seem to lock with an
    "UPDATE waiting" message like it did with 7.1 and 2.2.3, but the script
    still hangs. It's strange,
    because if I remove the superfluous Transaction "begin" and "commit", it
    runs fine.
    Any ideas on what might cause this?
    Thanks,
    -Mike
    private void runQuery() throws AppException {
    PersistenceManager pm=JDOFactory.getPersistenceManager();
    Transaction tx = pm.currentTransaction();
    tx.begin();
    tx.commit();
    Connection conn=null;
    Long listrunid=new Long (281);
    try {
    conn = JDOFactory.getConnection();
    String sql="update summaryreport set
    totalforwarded=totalforwarded+1 where listrunid=listrun.id and
    listrun.publicid=?";
    PreparedStatement stmt = conn.prepareStatement(sql);
    stmt.setLong(1, listrunid.longValue());
    _log.debug("executing: "+stmt);
    int result=stmt.executeUpdate();
    _log.debug("done executing: "+stmt);
    if (result==0) {
    _log.error("Nothing to update for id="+listrunid);
    catch (SQLException ex) {
    _log.error("SQLException: "+ex.getMessage());
    throw new AppException (ex.getMessage());
    finally {
    if (conn!=null) {
    try {conn.close();}
    catch(SQLException ex) {
    _log.warn(ex.getMessage());
    Mike Bridge

    Hi Patrick,
    You're right, that should be in a finally clause. However, my script seems
    to hang after about 10 to 30 of the 1000 iterations.
    -Mike
    Patrick Linskey wrote:
    Mike Bridge <[email protected]> writes:
    Hi-
    Here's a standalone program that shows the problem. If you remove the
    "tx.begin()" and "tx.commit()" lines,
    it seems to work fine. With them, I get some odd NullPointerExceptions at
    the start, then later it hangs.FTR, it looks like the hang is caused by the bit where threadDone() is
    only invoked when an exception is not thrown. If you move the
    threadDone() invocation to a finally clause, the hang will probably go
    away.
    -Mike
    import java.util.*;
    import javax.jdo.*;
    import java.sql.*;
    import com.solarmetric.kodo.impl.jdbc.*;
    * create table testtable (id INT, value INT);
    * insert into testtable(id, value) VALUES (1,0);
    public class ConcurrentTest {
    private static JDBCPersistenceManagerFactory factory = null;
    public boolean threadsaredone=false;
    public int iterations=0;
    public int threadsdone=0;
    public static Connection getConnection() throws SQLException {
    javax.sql.DataSource ds = (javax.sql.DataSource)
    factory.getConnectionFactory();
    return ds.getConnection ();
    public static PersistenceManager getPersistenceManager () {
    return factory.getPersistenceManager ();
    static {
    factory = new JDBCPersistenceManagerFactory ();
    factory.setNontransactionalRead (true);
    factory.setRetainValues (true);
    factory.setOptimistic (true);
    private void runQuery() {
    PersistenceManager pm=getPersistenceManager();
    Transaction tx = pm.currentTransaction();
    tx.begin();
    Connection conn=null;
    PreparedStatement stmt=null;
    int id=1;
    try {
    conn = getConnection();
    if (conn==null) {
    System.out.println("Connection is null");
    System.exit(1);
    String sql="update testtable set value=value+1 where id=?";
    stmt= conn.prepareStatement(sql);
    stmt.setLong(1, id);
    // System.out.println("executing: "+stmt);
    int result=stmt.executeUpdate();
    // System.out.println("done executing: "+stmt);
    if (result==0) {
    System.out.println("Nothing to update for id="+id);
    catch (SQLException ex) {
    System.out.println("SQLException: "+ex.getMessage());
    finally {
    if (conn!=null) {
    try {conn.close();}
    catch(SQLException ex) {System.out.println(ex.getMessage());}
    if (stmt!=null) {
    try {stmt.close();}
    catch(SQLException ex) {System.out.println(ex.getMessage());}
    tx.commit();
    public synchronized void threadDone(int threadid) {
    threadsdone++;
    System.out.println("Thread "+threadid+" is done");
    public synchronized void iterationstarted() {
    iterations++;
    System.out.println(" ** Starting iteration "+iterations);
    public void launch(int maxthreads, int repperthread) {
    runQuery();
    for (int i=0; i<maxthreads; i++) {
    System.out.println("launching thread "+i);
    Thread mythread=new MyThread(this, i, repperthread);
    mythread.start();
    while ( threadsdone<maxthreads ) {
    try {
    Thread.currentThread().sleep(2000);
    catch (InterruptedException ex) {
    System.out.println("Interrupted: "+ex.getMessage());
    System.out.println("threads reported finished: "+threadsdone);
    System.out.println("DONE!");
    public static void main (String[] args) {
    int maxthreads=10;
    int repperthread=100;
    ConcurrentTest ct=new ConcurrentTest();
    ct.launch(maxthreads, repperthread);
    private class MyThread extends Thread {
    ConcurrentTest testobj;
    int threadid;
    int repetitions;
    public MyThread(ConcurrentTest testobj, int threadid, int repetitions)
    this.testobj=testobj;
    this.threadid=threadid;
    this.repetitions=repetitions;
    public void run() {
    try {
    for (int i=0; i<repetitions; i++) {
    iterationstarted();
    System.out.println(" START iteration "+i+" for thread "+threadid);
    testobj.runQuery();
    System.out.println(" FINISH iteration "+i+" for thread "+threadid);
    testobj.threadDone(threadid);
    catch (Exception ex) {
    ex.printStackTrace();
    System.out.println("ERROR: "+ex.getMessage());
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Mike Bridge

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with threads running javaw

    Hi,
    Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
    troy.

    troy,
    Try and post a minimum code sample of your app which
    does not work.
    When using javaw, make sure you redirect the standard
    error and standard output streams to file.
    Graeme.Hi Graeme,
    I dont understand what you mean by redirection to file? some of my code below.
    The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
    public class Server{
    ServerSocket aServerSocket;
    Socket dianosticsSocket;
    Socket nPortExpress;
    ClientListener aClientListener;
    LinkedList queue = new LinkedList();
    int port = 0;
    int clientPort = 0;
    String clientName = null;
    boolean serverAlive = true;
    * Server constructor generates a server
    * Socket and then starts a client threads.
    * @param aPort      socket port of local machine.
    public Server(int aPort, String aClientName, int aClientPort){
    port = aPort;
    clientName = aClientName;
    clientPort = aClientPort;
    try{
    // create a new thread
    aServerSocket = new ServerSocket(port) ;
    // connect to the nPortExpress
    aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
    // aClientListener.setDaemon(true);
    aClientListener.start();
    // start a dianostic port
    DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
    // System.out.println("Server is running on port " + port + "...");
    // System.out.println("Connect to nPort");
    catch(Exception e)
    // System.out.println("ERROR: Server port " + port + " not available");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
    serverAlive = false;
    System.exit(1);
    while(serverAlive&&aClientListener.hostSocket.isConnected()){
    try{
    // connect the client
    Socket aClient = aServerSocket.accept();
    //System.out.println("open client connection");
    //System.out.println("client local: "+ aClient.getLocalAddress().toString());
    // System.out.println("client localport: "+ aClient.getLocalPort());
    // System.out.println("client : "+ aClient.getInetAddress().toString());
    // System.out.println("client port: "+ aClient.getLocalPort());
    // make a new client thread
    ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
    // start thread
    clientThread.start();
    catch(Exception e)
    //System.out.println("ERROR: Client connection failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
    }// end while
    } // end constructor Server
    void serverExit(){
         JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
         System.exit(1);
    }// end class Server
    *** connect to another server
    public class ClientListener extends Thread{
    InetAddress hostName;
    int hostPort;
    Socket hostSocket;
    BufferedReader in;
    PrintWriter out;
    boolean loggedIn;
    LinkedList queue;      // reference to Server queue
    Server serverRef; // reference to main server
    * ClientListener connects to the host server.
    * @param aHostName is the name of the host eg server name or IP address.
    * @param aHostPort is a port number of the host.
    * @param aLoginName is the users login name.
    public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer)      // reference to Server queue)
    hostName = aHostName;
    hostPort = aHostPort;
    queue = aQueue;
    serverRef = aServer;      
    // connect to the server
    try{
    hostSocket = new Socket(hostName, hostPort);
    catch(IOException e){
    //System.out.println("ERROR: Connection Host Failed");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);     
    System.exit(0);
    } // end constructor ClientListener
    ** multi client connection server
    ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
    queue = aQueue;
    addToQueue(this);
    client = aSocket;
    clientRef = aClientListener;
    aDiagnostic = diagnostics;
    } // end constructor ClientWorker
    * run method is the main loop of the server program
    * in change of handle new client connection as well
    * as handle all messages and errors.
    public void run(){
    boolean alive = true;
    String aSubString = "";
    in = null;
    out = null;
    loginName = "";
    loggedIn = false;
    while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
    if(aDiagnostic){
    out.println("WELCOME to diagnostics");
    broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    out.println("WELCOME to Troy's Server");
    broadCastDia("Connect : client "+client.getInetAddress().toString());
         out.flush();
    String line;
    while(((line = in.readLine())!= null)){
    StringTokenizer aStringToken = new StringTokenizer(line, " ");
    if(!aDiagnostic){
    broadCastDia(line);
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    else{
    if(line.equals("GETIPS"))
    getIPs();
    else{
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    } // end while
    catch(Exception e){
    // System.out.println("ERROR:Client Connection reset");
                             JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);     
    try{
    if(aDiagnostic){
    broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    broadCastDia("Disconnect : client "+client.getInetAddress().toString());
         out.flush();
    // close the buffers and connection;
    in.close();
    out.close();
    client.close();
    // System.out.println("out");
    // remove from list
    removeThreadQueue(this);
    alive = false;
    catch(Exception e){
    // System.out.println("ERROR: Client Connection reset failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);     
    }// end while
    } // end method run
    * method run - Generates io stream for communicating with the server and
    * starts the client gui. Run also parses the input commands from the server.
    public void run(){
    boolean alive = true;
    try{
    // begin to life the gui
    // aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
    // aGuiClient.show();
    in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
    while (alive && hostSocket.isConnected()){
    String line;
    while(((line = in.readLine())!= null)){
    System.out.println(line);
    broadCast(line);
    } // end while
    } // end while
    catch(Exception e){
    //     System.out.println("ERRORa Connection to host reset");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
    try{
    hostSocket.close();
         }catch(Exception a){
         JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
    alive = false;
    System.exit(1);
    } // end method run

  • Problem with threads and camera.

    Hi everybody!
    I've a problem with taking snapshot.
    I would like to display a loading screen after it take snapshot ( sometimes i
    have to wait few seconds after i took snapshot. Propably photo is being taken in time where i have to wait).
    I was trying to use threads but i didn't succeed.
    I made this code:
    display.setCurrent(perform);               
            new Thread(new Runnable(){
                public void run() {               
                    while((!performing.isShown()) && (backgroundCamera.isShown())){
                        Thread.yield();
                    notifyAll();
            }).start();
            new Thread(new Runnable(){
                public void run() {
                    try {
                        this.wait();                   
                    } catch(Exception e) {
                        exceptionHandler(e);
                    photo = camera.snapshot();                               
                    display.setCurrent(displayPhoto);
            }).start();This code is sometimes showing performing screen but sometimes no.
    I don't know why. In my opinion performing.isShown() method isn't working correctly.
    Does anyone have some idea how to use threads here?

    Hi,
    I've finally managed to work this fine.
    The code:
           Object o = new Object();
           display.setCurrent(perform);               
            new Thread(new Runnable(){
                public void run() {               
                    while(!performing.isShown()){
                        Thread.yield();
                   synchronized(o) {
                      o.notify();
            }).start();
            new Thread(new Runnable(){
                public void run() {
                    try {
                        synchronized(o) {
                           o.wait(1);
                    } catch(Exception e) {
                        exceptionHandler(e);
                    photo = camera.snapshot();                               
                    display.setCurrent(displayPhoto);
            }).start();

Maybe you are looking for

  • After update my iphone 4s doesn't work, i can't send messages and i can't call

    firstly excuse my english, i recently buy iphone 4s, i update with itunes, after the update, i couldn't do calls and i couldn't sent messages with my iphone, i tryed to restore network configuration but it doesn't work, although sometimes i can call

  • Can only see iWeb created site on iPhone

    I made some major changes today on my site and once I uploaded those changes Safari "couldn't find host" when I went to my site? What's weird is I can see my site on my iPhone. If I try to go to my site on any computer in the house it says "can't fin

  • N96 Firmware v12

    Has anyone updated to this firmware yet in the UK and if so has it finally sorted the WiFi bug ppl have been having with the Sky/Netgear broadband router x

  • Compressor does not recognize chapter markers

    I have exported my FCP timeline with chapter markers to a self-contained QT file. I have enabled the text track in the QT file. Now I want to encode the QT file to MPEG-2 with the chapter markers. But I don't see any markers in Compressor? I only see

  • Aperture 3 asks for my SN (after update) and won't accept my Ap2 to 3 'Update' SN

    I have just downloaded an update to Aperture 3 following a system 'update box' notification. Now, when trying to open Aperture it asks for the SN. When I enter the Aperture 3 SN from the software box it rejects it saying that was an 'update' SN, and