• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet : upload and converter a ppt to pdf

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hellow,
To upload and convert a ppt to pdf i use this servlet




i got this errors :

com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect(AbstractOpenOfficeConnection.java:81)
servlet.ajout.doPost(ajout.java:170)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


i run the OOe on localhost and 8100,
i have add the jobconverter jars to the buikdpath
i dont know what is the matter !!!
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What process runs and binds to port 8100 ? That seems to be missing. On a side note...

1. The servlet is a controller. It is doing more than what it should in your use case. A business object POJO is more suited to do the heavy lifting.
2. Class names must be in CamelCase.
3. A package named servlet does not sufficiently describe the intent of the classes under it.
4. Avoid using absolute paths / OS specific paths like (c:\)
5. After logging an exception with e.printStackTrace();, what does the user get to see on the browser ? Think about that.
6. I have many more but I am afraid they may side track your original question.
 
amine berrabah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:What process runs and binds to port 8100 ? That seems to be missing. On a side note...

1. The servlet is a controller. It is doing more than what it should in your use case. A business object POJO is more suited to do the heavy lifting.
2. Class names must be in CamelCase.
3. A package named servlet does not sufficiently describe the intent of the classes under it.
4. Avoid using absolute paths / OS specific paths like (c:\)
5. After logging an exception with e.printStackTrace();, what does the user get to see on the browser ? Think about that.
6. I have many more but I am afraid they may side track your original question.



hi,
i have run the open office service on localhost and 8100 by this bat :

@echo off


rem Init start parameters
set OOO_APP="C:\Program Files (x86)\OpenOffice.org 3\program\soffice.exe"
set OOO_PARAM=-headless -norestore
set OOO_SOCKET="-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;StarOffice.ServiceManager"- nofirststartwizard

rem Start OpenOffice.org
echo start "OpenOffice.org" %OOO_APP% %OOO_PARAM% %OOO_SOCKET% >>oo.log
start "OpenOffice.org" %OOO_APP% %OOO_PARAM% %OOO_SOCKET%

and i have used this class java to converte and it's work

package finale;

import java.io.File;
import java.net.ConnectException;

import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.openoffice.connection.*;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;

public class PptConvert{

public static void main(String[] args) {

String newname = "ra";


File inputFile = new File("C:\\file-ppt\\"+newname+".ppt");
System.out.println("Jointure de ppt en cours ...");

File outputFile = new File("C:\\file-essai\\"+newname+".pdf");
System.out.println("Creation de pdf en cours ...");

OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
System.out.println("Connexion avec OOo (localhost:8100) en cours ...");

try {
connection.connect();
System.out.println("Connexion éffectuée ... ");
} catch (ConnectException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
System.out.println("Convertion en cours ...");


connection.disconnect();
System.out.println("Deconnexion en cours ...");
}
}

so i dont see the exactely the error for the connection !


 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no valid explanation why the call would not work from a servlet. May be the open office server was simply down ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic