Java - ClassNotFoundException - not simple classpath issue

Creating a macro - Writing a Script - Using the API

Java - ClassNotFoundException - not simple classpath issue

Postby tstmartin » Thu Mar 08, 2012 8:38 pm

OOo 3.3.0
NetBeans 6.5.1
OOo API Plugin 2.0.4
Windows XP Pro SP2

Java SDK 1.6.0_17

---------------------------------

I was able to create a simple Java add-in that just concatenated an input string
with "HelloWorld".

Then I wrote an add-in to get data from an external Java API and load that into a
cell.

The target API uses the t3 protocol to talk to a WebLogic server.

The add-in works until it attempts to connect to the remote
server via:

serviceFactory.startup(loginProperties)

which throws a ClassNotFoundException, against the WebLogic
WLInitialContextFactory class:


Caused by: java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)



This class is found on the client side in wlfullclient.jar.
That jar is in the .oxt file;
I also tried putting it into the classpath using
the Tools->Options->Java settings.
No joy.

Other Java statements before the startup() statement can use the contents of the
wlfullclient.jar - for example, this statement will instantiate a
WLInitialContextFactory object:

WLInitialContextFactory wlInit = new WLInitialContextFactory();

So ... somehow the class is being found, until the startup() statement.

Thinking the problem may be RMI (and therefore network) related somehow, I've
tried disabling my firewall and setting all OOo->Tools->options->security
settings to off.

No joy.

Finally, thinking maybe I had a typo in my login data that I just couldn't see, I copy-and-pasted
all the login code into an eclipse project, and there, it ran just fine as an application.


loginProperties contains the username, password, server url and the name of the
initial context class.
The startup code does some sort of class name lookup on the name string ("weblogic.jndi.WLInitialContextFactory")to decide how to
instantiate the initial context .

At this point about all I can think of is that either OOo is blocking the RMI
connection , or maybe the classpath is partitioned in some way (sort of like the
way classloaders in WAR files are isolated from each other) that affects the
attempt to locate the WLInitialContextFactory using forName() rather than
via a

new Constructor()

call.

Do either of those ideas make any sense at all?
Any other ideas?
Any ideas how to proceed?


Thanks for any help :)

-tom
OOo 3.2.1 / Windows XP SP2
tstmartin
 
Posts: 2
Joined: Mon Mar 05, 2012 8:57 pm

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests