• 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

problem with tomcat embedded application

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I test a java class (source download from internet) within tomcat embedded (5.5.25). Inside Eclipse (3.2) my programm work fine. I make a jar file (with eclipse), but when I launch my application I have "Could not find main class".
(java version :1.6.0_03-b05)
Any idea?
Thanks.
[ November 24, 2007: Message edited by: Anna Ferrari ]
 
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you elaborate more on your problem? Did you create a web application or just a Java application? Are you trying to execute a Java application in you jar file?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the jar file include a manifest file that points to the class containing the main method?
 
Anna Ferrari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
first off all, sorry for my bad english. I try to lay out my problem.
I want to know if it is possible to run a web application without formally install and launch tomcat.
My existing web application works inside Tomcat.
I downloaded from internet a tomcat embedded version. After that, I created an eclipse project using a java source code downloaded.
My code Embed55.java uses following import :


In the eclipse project :

1) I created a user library with inside all jar file contained in ...\apache-tomcat-5.5.25-embed\lib
2) I copied (inside the project) from ..\apache-tomcat-5.5.25-embed the following directories :

3) I copied my web application gestlav (directory from my tomcat) inside of webapps.

That's all.
I run Embed55.java (FROM ECLIPSE) and inside eclipse console tomcat starts :

25-nov-2007 14.26.45 org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
25-nov-2007 14.26.46 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
.....
.....

I open browser and write : http:\\localhost:8080\gestlav\
and my web application starts.

If I make a jar file (with eclipse) and put it in C:\Embed.jar
when I click twice jar file I have : Could not find main class

Jar file contains:

pippo
Embed55.class
webapps
conf
META-INF
MANIFEST.MF


This is META-INF/MANIFEST.MF

after Main-Class it is one blank line
Please, why?
Thanks for your help.
[ November 25, 2007: Message edited by: Anna Ferrari ]
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I'm gonna be brave and do what I can. Nobody critic me until more information from Anna Ferrari.

First, your english is pretty good - let's focus on the code and problems.

[Anna Ferrari:]   I test a java class (source download from internet) within tomcat embedded (5.5.25).

There are many sources on the internet, and what test class ?

[Anna Ferrari:]   Inside Eclipse (3.2) my programm work fine. I make a jar file (with eclipse), but when I launch my application I have "Could not find main class".

Eclipse understands a lot of things about java, and may not need a main class. A main class is a class with a main(String[] args) method, that's what a main class is - end of discussion. ( that's idiomatic and does not mean any mean meanings )

[Anna Ferrari:]   I want to know if it is possible to run a web application without formally install and launch tomcat.

I do it all the time, but some patience is really necessary.

[Anna Ferrari:]   Main line is :

Your main() method ... and where did Embed55(); come from, may we see the sources ?

java.util.LinkedList<Integer> list = new java.util.LinkedList<Integer>();
You have an extra code tag in that line, you can edit your own posts. Clumsy but necessary.

tomcat.startTomcat(); ... where did this come from ? { I am not begin critical, it just seems out of place in the scope of your question }

//---- THIS IS MY WEB APPLICATION

Applications ( in Tomcat ) are in some other files, called extensible markup language, they harrow me. I will let others tell you what those files are and where they are used. What is gestlav ? Why do you call Thread.sleep() ?

[Anna Ferrari:]   If I make a jar file (with eclipse) and put it in C:\Embed.jar when I click twice jar file I have : Could not find main class

eclipse may .... Tomcat and running apps ( applications ) sorta gets things mixed together that sounds to me like what the answer to your question is is that an application, a stand-alone application has a main method: which I don't think eclipse and Tomcat working together are going to be especially concerned about.

When you go outside of eclipse and Tomcat and start trying to run an application, lets just say you need to expect to do some reading and spend some time getting acclimatized to what is going on.

http:\\localhost:8080\gestlav\ is different from a stand-alone program. after Main-Class it is one blank line doesn't matter, a few blank lines are not going to be of excessive concern.

[Anna Ferrari:]   when I click twice jar file I have : Could not find main class

Better just start reading and read some more, then come back and post again. Servlets and writing programs have some differences, one-click is not going to launch an app until more work is done.
[ November 25, 2007: Message edited by: Nicholas Jordan ]
 
Anna Ferrari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
thank you very much, for your attention.
I'm very confused, therefor I decide to move off with an other code.
I take this code from :
web page

I change a little the code, because for example I don't find Deployer class in side my tomcat embedded version.
Here is the code (I think it is similar to the old) :



My intention is to make run my web application in side a pen drive.
I dowloaded Server2Go.exe and I put it in the pen drive because my app requires mysql.
I put tomcat-embedded version in the pen drive.
Now my problem is to make "some thing" to start a tomcat version (in side the pen) for open (with the browser) my web application.
My intention is to put the pen drive in an other PC and to launch my web appl.
Is it possible? Or is it an other way to do some thing like this?
Thanks.
[ November 26, 2007: Message edited by: Anna Ferrari ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since now you have a class with a main method, you can include a manifest file that points to that class in your jar file. Then you can start Tomcat by double-clicking that jar file.
 
Anna Ferrari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
unfortunately this dont't works. I make jar file from eclipse, manifest.mf is ok, but nothing, I have always : COULD NOT FIND MAIN CLASS.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then perhaps your manifest.mf is not ok?
 
Anna Ferrari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
probably you're right. I keep manifest like eclipse make it. But it isn't enought. Maybe I have to add a lot of tomcat jar files in the manifest class-path or launch the java class with a crazy mode. I don't like this solution. I thought this way more simple that what it really is.
I have to look for an other way. Probably I have to think something outside web application.
For now, thank you very much.
 
reply
    Bookmark Topic Watch Topic
  • New Topic