Did you try to disable the validation? You might have a validation provider present in the classpath when you run outside of OSGi. In OSGi, the validation provider must be "OSGi-enabled" in order to be found by OpenJPA.
/Bengt 2012/4/26 Borut Bolcina <[email protected]> > Aha, yes it does work as I have several unit tests, one of them is > persisting the data just fine with the same route, aka jpa component which > is configured with persistence.xml with the same credentials and url > connection string. > > Borut > > Sent from my iPad > > On 26. apr. 2012, at 15:50, Christian Schneider <[email protected]> > wrote: > > That is not what I meant. Try to connect to the datasource using jdbc in > the same way as in the osgi connect but in a simple little java class with > a main method. > So you can test that jdbc, the connection string and your credentials > really work. > > Christian > > Am 26.04.2012 13:16, schrieb Borut Bolčina: > > Yes I can connect to the database and the data is there. Double checked. > > [email protected]:~$ mysql -u userA -p > Enter password: > Welcome to the MySQL monitor. Commands end with ; or \g. > Your MySQL connection id is 251676 > Server version: 5.1.41-3ubuntu12.10-log (Ubuntu) > > userA@localhost:(none)> use weather; > Reading table information for completion of table and column names > You can turn off this feature to get a quicker startup with -A > > Database changed > userA@localhost:weather> show tables; > +--------------------------+ > | Tables_in_weather | > +--------------------------+ > | weather_my_table_which_holds_some_data | > | weather_xxx | > | weather_xxxx | > | weather_xxxxx | > | weather_xxxxxx | > +--------------------------+ > 5 rows in set (0.00 sec) > > userA@localhost:weather> select * from > weather_my_table_which_holds_some_data ; > > +--------+-------------+-----------------+------------+-------------+-------------------------------------------------+-----------------------------------+---------------------+----------------------+ > | rec_no | skislope_id | skislope | conditions | temperature | link > | phonenum > | published | successfully_updated | > > +--------+-------------+-----------------+------------+-------------+-------------------------------------------------+-----------------------------------+---------------------+----------------------+ > | 1025 | sneg_1 | ccc | NULL | 6 | > http://www.xxx.si/default.asp?sid=1 | xxx telefon: 031/041 182501 | > 2011-08-10 07:54:00 | 2011-08-10 14:19:46 | > > > Maybe permissions are in question. > > -borut > > Dne 26. april 2012 12:58 je Christian Schneider > <[email protected]>napisal/-a: > >> The service lists look good but that the db command does not work shows >> that there is a problem. The problem seems to be already in the datasource >> though. >> >> Can you try to access the datasource directly outside of OSGi and make >> sure that it is correct? >> >> Christian >> >> Am 26.04.2012 12:29, schrieb Borut Bolčina: >> >> Hi, >> >> Dne 26. april 2012 11:09 je Christian Schneider >> <[email protected]>napisal/-a: >> >>> You can check if the datasource works by using my db commands for karaf: >>> https://github.com/cschneider/Karaf-Tutorial/tree/master/db/command >>> >> >> Installed: >> karaf@root> install -s >> mvn:net.lr.tutorial.karaf.db/db-command/1.0-SNAPSHOT >> Bundle ID: 129 >> >> Selected: >> karaf@root> db:select jdbc/mysqlds >> >> But the query returns nothing: >> karaf@root> db:exec "select * from my_table_which_holds_some_data" >> >> >> >>> >>> You should also check with the service:list command if the blueprint.xml >>> offers the DataSource service. >>> >> >> Yes, i think it does: >> >> weather-datasource (123) provides: >> ---------------------------------- >> javax.sql.DataSource >> org.osgi.service.blueprint.container.BlueprintContainer >> >> OpenJPA Aggregate Jar (125) provides: >> ------------------------------------- >> javax.persistence.spi.PersistenceProvider >> >> weather-model (128) provides: >> ----------------------------- >> javax.persistence.EntityManagerFactory >> >> >> Thanks for the tips. Will have to dig some more into the issue. >> >> -borut >> >> >> >> >> -- >> >> Christian Schneiderhttp://www.liquid-reality.de >> >> Open Source Architect >> Talend Application Integration Division http://www.talend.com >> >> > > > -- > Christian Schneiderhttp://www.liquid-reality.de > > Open Source Architect > Talend Application Integration Division http://www.talend.com > >
