Re: EnterpriseObjects in a regular Java application
Re: EnterpriseObjects in a regular Java application
- Subject: Re: EnterpriseObjects in a regular Java application
- From: "John Huss" <email@hidden>
- Date: Mon, 30 Jan 2006 15:46:37 -0600
I'm still having problems with this. It seems to be
having trouble loading Bundles or something.
I tried several different things. The most promising
has been the approach described here:
http://www.wodeveloper.com/omniLists/eof/2002/March/msg00018.html
My code looks like this (Import.java):
public static void main (String args[])
{
try {
JDBCAdaptor adaptor = new
JDBCAdaptor("JavaJDBCAdaptor");
EODatabase database = new
EODatabase(adaptor);
EODatabaseContext dbContext = new
EODatabaseContext(database);
EOObjectStoreCoordinator.defaultCoordinator().addCooperatingObjectStore(dbContext);
//Using EOModelGroup.defaultGroup() caused an exception (same one reported
below), so I created a new one instead.
EOModelGroup modelGroup = new EOModelGroup();
EOModel model =
modelGroup.addModelWithPathURL( new File("MyModel.eomodeld").toURL()
);
adaptor.setConnectionDictionary(model.connectionDictionary());
database.addModel(model);
// this causes an exception
modelGroup.loadAllModelObjects();
} catch
(java.net.MalformedURLException e) {
e.printStackTrace();
}
.....
}
When I run it I get this exception:
Exception in thread "main"
java.lang.ExceptionInInitializerError
at
com.webobjects.eoaccess.EOAdaptor.infoDictionaryForAdaptorNamed(EOAdaptor.java:238)
at
com.webobjects.eoaccess.EOAdaptor.classNameForAdaptorNamed(EOAdaptor.java:254)
at
com.webobjects.eoaccess.EOAdaptor.classForAdaptorNamed(EOAdaptor.java:271)
at
com.webobjects.eoaccess.EOAdaptor.adaptorWithName(EOAdaptor.java:295)
at
com.webobjects.eoaccess.EOAdaptor.adaptorWithModel(EOAdaptor.java:325)
at
com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:610)
at
com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java:652)
at
com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:923)
at
com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:675)
at
com.webobjects.eoaccess.EOEntity._loadEntity(EOEntity.java:3704)
at
com.webobjects.eoaccess.EOModel.loadAllModelObjects(EOModel.java:1830)
at
com.webobjects.eoaccess.EOModelGroup.loadAllModelObjects(EOModelGroup.java:682)
at SalondataComparisonImport.main(Import.java:23)
Caused by:
java.lang.NullPointerException
at
com.webobjects.foundation.NSBundle.LoadUserAndBundleProperties(NSBundle.java:640)
at
com.webobjects.foundation.NSBundle.<clinit>(NSBundle.java:367)
... 13 more
I've included all the necessary jars I think: EOAccess,
EOControl, JavaFoundation, JavaXML, JDBCAdaptor, FrontBasePlugIn
Any ideas are welcome.
Thanks!
John
----- Original Message -----
Sent: Monday, January 30, 2006 3:24 AM
Subject: RE: EnterpriseObjects in a regular Java
application
> Hi,
>
> there is a little bit outdated stepwise article about this
issue:
> http://www.stepwise.com/Articles/Technical/2001-07-01.01.html>
> It has helped me to create a java console app.
>
> HTH
> Frank
>
>
>> -----Original
Message-----
>> From: webobjects-dev-bounces+webobjects=email@hidden>>
[mailto:webobjects-dev-bounces+webobjects=symposion.de@lists.a
>>
pple.com]O
>> n Behalf Of John Huss
>> Sent: Friday, January
27, 2006 9:35 PM
>> To: email@hidden>> Subject: EnterpriseObjects in a regular Java
application
>>
>>
>> Is it possible to use my
EnterpriseObjects classes and
>> EOModel in a regular
>>
Java application without any web interface?
>>
>> How do I
get a connection to the database and get an editing context?
>>
>> My ultimate goal is to write a little command-line program
>> that will import
>> text files into a database at
scheduled times. If this is a
>> bad approach
>> I'm
open to other ideas.
>>
>> Thanks,
>> John
>>
>>
_______________________________________________
>> Do not post admin
requests to the list. They will be ignored.
>> Webobjects-dev mailing
list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> email@hidden
>>
>> This email sent
to email@hidden>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden