Actually, I found the jar file, but now I get NullPointerExceptions. I
traced this through to the QueryImpl class and a member variable
Collection which is never set. The offending member is the
"imports" Collection which I assume is where the package names which are
to be instansiated and returned are stored.
The exact error is:
java.lang.NullPointerException
at
org.apache.ojb.jdo.jdoql.QueryTreeResolver.checkImports(QueryTreeResolve
r.java:117)
at
org.apache.ojb.jdo.jdoql.QueryTreeResolver.resolveAndCheck(QueryTreeReso
lver.java:86)
at org.apache.ojb.jdo.QueryImpl.compile(QueryImpl.java:302)
at org.apache.ojb.jdo.QueryImpl.execute(QueryImpl.java:323)
at com.tsi.test.jdo.JDOTest.<init>(JDOTest.java:72)
at com.tsi.test.jdo.JDOTest.main(JDOTest.java:79)
Exception in thread "main"
The code which generates this problem is:
public JDOTest(int garbage)
{
Properties props = new Properties();
props.put("javax.jdo.PersistenceManagerFactoryClass",
"org.apache.ojb.jdo.PersistenceManagerFactoryImpl");
// PersistenceManagerFactory pmf = new
PersistenceManagerFactoryImpl();
PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(props);
pmf.setConnectionUserName("guest");
pmf.setConnectionPassword("guest");
pmf.setConnectionDriverName("com.mysql.jdbc.Driver");
pmf.setConnectionURL("jdbc:mysql://localhost/tsi");
PersistenceManager pm = pmf.getPersistenceManager();
// 2. Build a query to look up product by the id
int id = 1;
Query query = pm.newQuery(Product.class);
// 3. execute query
Collection result = (Collection) query.execute();
Product x = (Product) result.iterator().next();
}
Is there another call I have to make in order to populate the "imports"
Collection?
Cheers,
Philip.
-----Original Message-----
From: Philip Denno [mailto:[EMAIL PROTECTED]
Sent: March 30, 2005 2:19 PM
To: OJB Users List
Subject: RE: Setup Question.
I have created a demo program which allows me to persist my data to
mysql but when I read the data back out I get the following error:
java.lang.NoClassDefFoundError: antlr/TokenStreamException
at org.apache.ojb.jdo.QueryImpl.setFilter(QueryImpl.java:145)
at
org.apache.ojb.jdo.PersistenceManagerImpl.newQuery(PersistenceManagerImp
l.java:364)
at com.tsi.test.jdo.JDOTest.<init>(JDOTest.java:68)
at com.tsi.test.jdo.JDOTest.main(JDOTest.java:78)
Exception in thread "main"
Does anybody know which jar file this package is in?
Thanks for all your help so far.
Cheers,
Philip.
-----Original Message-----
From: Philip Denno [mailto:[EMAIL PROTECTED]
Sent: March 30, 2005 11:34 AM
To: OJB Users List; Thomas Dudziak
Subject: RE: Setup Question.
Thanks Thomas, changing the platform="mysql" to platform="MySQL" works.
Cheers,
Philip.
-----Original Message-----
From: Thomas Dudziak [mailto:[EMAIL PROTECTED]
Sent: March 30, 2005 11:13 AM
To: OJB Users List
Subject: Re: Setup Question.
On Wed, 30 Mar 2005 11:09:52 -0800, Philip Denno <[EMAIL PROTECTED]>
wrote:
> Thanks, that makes sense.
>
> I replaced the jar file to be 1.0.2 and it now loads fine. Now I get
> the following problem when I launch related to the
> repository_database.xml
>
> Once again I took the defaults from the apache website and attempted
> to customize them. The exact warning from OJB is:
>
> [DEFAULT] WARN: [PlatformFactory] problems with platform
> org.apache.ojb.broker.platforms.PlatformMysqlImpl:
> org.apache.ojb.broker.platforms.PlatformMysqlImpl
> [DEFAULT] WARN: [PlatformFactory] OJB will use PlatformDefaultImpl
> instead
>
> I modified the default file so that it looks like the following:
>
> <jdbc-connection-descriptor
> jcd-alias="default"
> default-connection="true"
> platform="mysql"
> jdbc-level="2.0"
> driver="com.mysql.jdbc.Driver"
> protocol="jdbc"
> subprotocol="mysql"
> dbalias="tsi"
> username="guest"
> password="guest"
> batch-mode="false"
> useAutoCommit="1"
> ignoreAutoCommitExceptions="false"
> >
>
> Are any of these settings incorrect? What exactly is wrong with the
> mysql platform class?
The platform setting is case sensitive, if you use "MySQL" as the value,
then it should work.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]