Hi,

it is probably not a good idea in general to connect to the database during the extension installation. I don't know the reasons for doing it during the installation but i would think about it. Keep the registration short and easy.

Anyway that wouldn't solve your problem and would only postpone it on later during the runtime of the office.

I am not sure if it really helps in this case but often it is a problem with the context classloader.

Before you call in any external library it is good practice (and i highly recommend it) to set the context class loader accordingly. Many external libs rely on a well prepared default class loader (including the whole classpath etc.). In case of UNO components we prepare "private class loaders" for every extension and you have to ensure that everything you need is configured in the manifest.

Try the following before you call in the external lib

ClassLoader cl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
...
// external code
...
Thread.currentThread().setContextClassLoader(cl);

Juergen


Manoj Chauhan wrote:
Dear Sir/madam

I'm a java programmer in company and developing a extension for open office
thru java code. I'm developing transliteration tool
and trying to transliterate current document. We are using my sql jar and
already included in Library folder. But error is occuring.  I need your
help. Please give me some solution. if possible, so please send code
snnipet. It's your greate obliged at me. I' m waiting for your reply.

Thanx & Regards
Manoj Chauhan



setting up UNO environment ...
build UNO idl files finished
uno-idl-compile:
init:
deps-jar:
Compiling 1 source file to F:\_Piyali_Tests\AkWriterAddOn\build\classes
compile:
Building jar: F:\_Piyali_Tests\AkWriterAddOn\dist\AkWriterAddOn.jar
Updating property file:
F:\_Piyali_Tests\AkWriterAddOn\build\regclass.properties
Updating property file:
F:\_Piyali_Tests\AkWriterAddOn\build\regclass.properties
jar:
Building jar: F:\_Piyali_Tests\AkWriterAddOn\dist\AkWriterAddOn.jar
images:
registry:
Deleting: F:\_Piyali_Tests\AkWriterAddOn\dist\AkWriterAddOn.oxt
creating UNO extension package ...
Building zip: F:\_Piyali_Tests\AkWriterAddOn\dist\AkWriterAddOn.oxt
uno-package:
C:\Program Files\OpenOffice.org 3/program\unopkg gui -f
F:\_Piyali_Tests\AkWriterAddOn\dist\AkWriterAddOn.oxt
C:\Program Files\OpenOffice.org 3/program\soffice
java.sql.SQLException: Server connection failure during transaction. Due to
underlying exception: 'java.net.SocketException: java.net.SocketException:
Invalid argument: connect'.
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.SocketException: Invalid argument: connect
STACKTRACE:
java.net.SocketException: java.net.SocketException: Invalid argument:
connect
        at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2680)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
        at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at com.example.AkDataPicker.connectToMySql(AkDataPicker.java:29)
Aug 21, 2009 2:59:07 PM com.example.AkWriterAddOn dispatch
SEVERE: null
java.lang.NullPointerException
        at com.example.AkWriterAddOn.dispatch(AkWriterAddOn.java:150)
        at com.example.AkWriterAddOn.dispatch(AkWriterAddOn.java:149)

** END NESTED EXCEPTION **

Attempted reconnect 3 times. Giving up.



---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-unsubscr...@openoffice.org
For additional commands, e-mail: discuss-h...@openoffice.org

Reply via email to