OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

NoClassDefFoundError Exception (Bootstrap)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Mon Jun 11, 2007 5:52 am    Post subject: NoClassDefFoundError Exception (Bootstrap) Reply with quote

When I try to run the Servlet Example coming from the OpenOffice.org_2.2_SDK, then I receive the following Exception:

Code:

javax.servlet.ServletException: Servlet execution threw an exception


root cause

java.lang.NoClassDefFoundError: com/sun/star/comp/helper/Bootstrap
   ConverterServlet.convertDocument(ConverterServlet.java:225)
   ConverterServlet.doPost(ConverterServlet.java:132)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



Line 225 in the ConverterServlet.java is the following one:
Code:

XComponentContext xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);


I am using the Makefile which comes with the java example.

Any ideas why?

Thanks!
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Mon Jun 11, 2007 11:10 am    Post subject: Re: NoClassDefFoundError Exception (Bootstrap) Reply with quote

bolekovnik wrote:
Any ideas why?

Might be a CLASSPATH problem as most NoClassDefFoundErrors are.

Read more in this threads on calling OOo from Java:
- "no office executable found" - error in tomcat: http://www.oooforum.org/forum/viewtopic.phtml?t=50715&highlight=bootstrap
- OO + Loader + Log4j: http://www.oooforum.org/forum/viewtopic.phtml?t=39950&highlight=bootstrap
- Use OOo with an independent Java program: http://www.oooforum.org/forum/viewtopic.phtml?t=41093&highlight=bootstrap+classpath
- error in importing open office SDK: http://www.oooforum.org/forum/viewtopic.phtml?t=19474&highlight=classpath
- Using Java with OOo: http://www.oooforum.org/forum/viewtopic.phtml?t=32724&highlight=noclassdeffounderror
- Launching OO in java: http://www.oooforum.org/forum/viewtopic.phtml?t=45042&highlight=bootstrap

Regards
hol.sten
Back to top
View user's profile Send private message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Tue Jun 12, 2007 8:59 am    Post subject: Reply with quote

Thanks hol.sten for the reply,

I went through all your links a tried some of the test, which were described. I tried that one: http://www.oooforum.org/forum/viewtopic.phtml?t=19474&highlight=classpath and was surprised why it works only if you set the OOOLIBPATH while you are executing the .bat file???

My set's are as follow:
Code:

ALLUSERSPROFILE=C:\Documents and Settings\All Users
ANT_HOME=C:\java\ant
CLASSPATH=D:\SAPjco\sapjco.jar;C:\Program Files\OpenOffice.org 2.0\program\classes\juh.jar;C:\Program Files\OpenOffice.org 2.0\program\classes\jurt.jar;C:\Program Files\OpenOffice.org 2.0\program\clas
ses\ridl.jar;C:\Program Files\OpenOffice.org 2.0\program\classes\sandbox.jar;C:\Program Files\OpenOffice.org 2.0\program\classes\unoil.jar
ClusterLog=C:\WINDOWS\Cluster\cluster.log
CommonProgramFiles=C:\Program Files\Common Files
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
JAVAC=C:\java\j2sdk1.4.2_10\bin
JAVA_HOME=C:\java\j2sdk1.4.2_10
LOGONSERVER=\\ESTADDC1
NUMBER_OF_PROCESSORS=4
OFFICE_PROGRAM_PATH=C:\Program Files\OpenOffice.org 2.0\program
OO_HOME=C:\Program Files\OpenOffice.org 2.0
OO_LIB_PATH=C:\Program Files\OpenOffice.org 2.0\program\classes
OO_SDK_HOME=C:\Program Files\OpenOffice.org_2.2_SDK
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\ARIS70;D:\SAPjco;C:\java\j2sdk1.4.2_
10\bin;C:\java\ant\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0403
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=RDP-Tcp#1
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\DARIUS~1\LOCALS~1\Temp\1
TMP=C:\DOCUME~1\DARIUS~1\LOCALS~1\Temp\1
windir=C:\WINDOWS


OK, never the less, I am desparated trying to run my Servlet and it still not working? I saw in this Post: http://www.oooforum.org/forum/viewtopic.phtml?t=50715&highlight=servlet that you have to tell Tomcat where it can find the OpenOffice.org classes? I don't know where??? Can you tell me how to setup Tomcat so I can run my OOo Servlets?

Thanks!
Back to top
View user's profile Send private message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Tue Jun 12, 2007 9:04 am    Post subject: Reply with quote

I found this in the settings/std.mk file:

Code:

SDK_JAVA_UNO_BOOTSTRAP_FILES=\
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/Loader.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/Loader$$CustomURLClassLoader.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/InstallationFinder.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/InstallationFinder$$StreamGobbler.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/WinRegKey.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)com/sun/star/lib/loader/WinRegKeyException.class$(SQM) \
   -C $(CLASSES_DIR) $(SQM)win/unowinreg.dll$(SQM)


Maybe all the loader classes are important for Tomcat???
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Tue Jun 12, 2007 9:37 am    Post subject: Reply with quote

bolekovnik wrote:
I tried that one: http://www.oooforum.org/forum/viewtopic.phtml?t=19474&highlight=classpath and was surprised why it works only if you set the OOOLIBPATH while you are executing the .bat file???

You didn't look hard enough. Look again. I showed 2 tries. The first didn't work, the second worked. The .bat file of the second try contained this two lines:
Code:
set OOOLIBPATH=c:\programme\OpenOffice.org1.1.4\program\classes
set CLASSPATH=%OOOLIBPATH%\unoil.jar

The first line defines OOOLIBPATH and uses that variable with %OOOLIBPATH% in the second line. That's all.

bolekovnik wrote:
OK, never the less, I am desparated trying to run my Servlet and it still not working? I saw in this Post: http://www.oooforum.org/forum/viewtopic.phtml?t=50715&highlight=servlet that you have to tell Tomcat where it can find the OpenOffice.org classes? I don't know where???

You don't tell Tomcat with a CLASSPATH variable how to find .jar files. You have to put the .jar files in one of the folders Tomcat uses to load .jar files. Read more on this here or google yourself for more:
- Tomcat documentation: http://tomcat.apache.org/tomcat-6.0-doc/appdev/deployment.html
- How to edit CLASSPATH in TOMCAT? http://forum.java.sun.com/thread.jspa?threadID=316391&messageID=1273633
- German "Tomcat: Wie konfiguriere ich den classpath meines servlets?": http://entwickler-forum.de/showthread.php?t=33674
For that, as far as I know, you have to use the older connection mechanism which has been discussed in this thread: http://www.oooforum.org/forum/viewtopic.phtml?t=39950&highlight=connection. Try this thread http://www.oooforum.org/forum/viewtopic.phtml?t=29097 if you need some more Java code about the connection mechanism. And this thread for OOo's listen parameter http://www.oooforum.org/forum/viewtopic.phtml?t=19790.

Or you try another approach, which I'm using for some time now, because I didn't like that all the OOo .jar files and OOo connections etc. run "inside" Tomcat (or at least inside the same java virtual machine): Use RMI! It works like a charm. Put all the OOo stuff in one application and call that through RMI from your servlet. Doing it that way you can use the conncetion mechanism you prefer.

Regards
hol.sten
Back to top
View user's profile Send private message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Wed Jun 13, 2007 6:32 am    Post subject: Reply with quote

Quote:
You didn't look hard enough. Look again. I showed 2 tries. The first didn't work, the second worked. The .bat file of the second try contained this two lines:


Maybe I should explain it better. I didn't say that your second try doesn't work, I just said that I am surprised that even if I set the OOLIBPATH already before in the System variables, I have to set it again in the batch file, so that the test app is running properly.

....
NUMBER_OF_PROCESSORS=4
OFFICE_PROGRAM_PATH=C:\Program Files\OpenOffice.org 2.0\program
OO_HOME=C:\Program Files\OpenOffice.org 2.0
OO_LIB_PATH=C:\Program Files\OpenOffice.org 2.0\program\classes
OO_SDK_HOME=C:\Program Files\OpenOffice.org_2.2_SDK

OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\ARIS70;D:\SAPjco;C:\java\j2sdk1.4.2_
10\bin;C:\java\ant\bin
...

Anyway, regarding my servlet problem, I did put the jar files in the Tomcat directory as you said and now I am getting at least a different Exception:

Code:

Cause Exception: null
Message Exception: no office executable found!
com.sun.star.comp.helper.BootstrapException: no office executable found!
   at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:253)
   at ODFServlet.runODF(ODFServlet.java:93)
   at ODFServlet.doGet(ODFServlet.java:74)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Unknown Source)


I put those jar files in the following directory: CATALINA_HOME/shared/lib.

Here is the test method I am trying to execute in my servlet for a better understanding:

Code:

public void runODF() throws IOException
{
   com.sun.star.uno.XComponentContext xContext = null;
   Runtime runtime = Runtime.getRuntime();
   String path = "C:/Program Files/OpenOffice.org 2.0/program/soffice.exe";

   runtime.exec( path );
   
   try
   {
      xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
      if( xContext != null )
      {
         System.out.println("Connected to a running office ...");
      } else {
               System.out.println("Not connected to a running office ...");
        }

        xContext = null;

        System.exit(0);
   }
   catch( Exception e )
   {
      System.err.println( "Cause Exception: "+e.getCause() );
      System.err.println( "Message Exception: "+e.getMessage() );
      e.printStackTrace();
      System.exit(1);
   }
}
Back to top
View user's profile Send private message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Wed Jun 13, 2007 8:20 am    Post subject: Reply with quote

This thread tells me to refer directly to OpenOffice program, which makes actualy sense:
http://osdir.com/ml/openoffice.devel.general/2007-01/msg00093.html.

But it still doesn't run... Sad
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Wed Jun 13, 2007 8:58 am    Post subject: Reply with quote

bolekovnik wrote:
Quote:
You didn't look hard enough. Look again. I showed 2 tries. The first didn't work, the second worked. The .bat file of the second try contained this two lines:

Maybe I should explain it better.

Maybe you should really look harder!

bolekovnik wrote:
I just said that I am surprised that even if I set the OOLIBPATH already before in the System variables, I have to set it again in the batch file, so that the test app is running properly.
...
OO_LIB_PATH=C:\Program Files\OpenOffice.org 2.0\program\classes
...

As I already told you, in my bat file one line defines OOOLIBPATH and uses that variable with %OOOLIBPATH% in the following line. I named that variable OOOLIBPATH with three O, three! Not two like OOLIBPATH as in your last post. And nothing with underscores like OO_LIB_PATH.

Ok, now again: OOOLIBPATH, OOLIBPATH, and OO_LIB_PATH are the names of three different variables! And you didn't set OOOLIBPATH in your environment so it has to be set in the bat file.

But anyway, even if you got it now, this doesn't solve your Tomcat problem!

bolekovnik wrote:
Anyway, regarding my servlet problem, I did put the jar files in the Tomcat directory as you said and now I am getting at least a different Exception:
Code:
...
Message Exception: no office executable found!

Which has already been discussed in this forum. And has been the topic of the first link I posted in my first reply in this thread for you!

bolekovnik wrote:
I put those jar files in the following directory: CATALINA_HOME/shared/lib.

Which is in vain, if you're using the bootstrap connection mechanism!

bolekovnik wrote:
Here is the test method I am trying to execute in my servlet for a better understanding:
Code:
...
      xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
...

As far as I know this will not work in Tomcat.

So I repeat it for you for the last time in this thread: Use the older connection mechanism with Tomcat or use a Java application which is not running within Tomcat in conjunction with something like RMI. I don't provide any further links, because this thread already contains enough unread links...
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Wed Jun 13, 2007 9:01 am    Post subject: Reply with quote

bolekovnik wrote:
This thread tells me to refer directly to OpenOffice program, which makes actualy sense:
http://osdir.com/ml/openoffice.devel.general/2007-01/msg00093.html.

But it still doesn't run... Sad

Because you are ignoring my replies Sad
Back to top
View user's profile Send private message
bolekovnik
General User
General User


Joined: 24 Jan 2006
Posts: 20

PostPosted: Thu Jun 14, 2007 2:06 am    Post subject: Reply with quote

Quote:
Because you are ignoring my replies Sad


I messed something up and that's why nothing is running.

Sorry for bothering you with the CLASSPATH and OOLIBPATH. I was confused about the names, but figured out, that it has to be OOLIBPATH and not SOMETHING_ELSE.

I need to reinstall my server anyway and will try out everything from scratch.

Thanks for your help!
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Thu Jun 14, 2007 8:21 am    Post subject: Reply with quote

bolekovnik wrote:
Quote:
Because you are ignoring my replies Sad


I messed something up and that's why nothing is running.

Sorry for bothering you with the CLASSPATH and OOLIBPATH. I was confused about the names, but figured out, that it has to be OOLIBPATH and not SOMETHING_ELSE.

Thank you for your clarification Smile

bolekovnik wrote:
I need to reinstall my server anyway and will try out everything from scratch.

If you still try Tomcat, try the older connection mechanism and not the bootstrap connection mechanism. Although it seams that the bootstrap connection mechanism is easier to handle, it has some disadvantages as you can read in the various threads I posted here.

Regards
hol.sten
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group