facebook

[Closed] Tomcat 5.5 deployment from MyEclipse

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #262242 Reply

    Hi,

    I try to get javamail working. Using tomcat they claim that the activation.jar and mail.jar must be under tomcat/common/lib and not in webapps…/WEB-INF/lib.
    How can I set the classpath for eclipse AND deployment correctly. When moving the jar-files from the eclipse project Web App Libraries Folder into the tomcat/common/lib directory, the editor claims that the classes can’t be resolved (of course) and deploying the project leads to a unresolved compilation problem. Any hints where to adjust this in eclipse with myeclipse tomcat deployment?

    regards

    Dani

    #262250

    Dani,

    Please try to add libraries to Project Build Path (right click on your project; choose Properties, Java Build Path, tab Libraries, Add External JARs).

    Snjeza

    #262255

    That was also what I expected to be the right place to add the library, but if I do so, the eclipse editor is fine (finds all the classes), but when I run the the application under tomcat it claims the following:

    Caused by: java.lang.Error: Unresolved compilation problems:
    The import javax.mail cannot be resolved
    The import javax.mail cannot be resolved
    The import javax.activation cannot be resolved
    AddressException cannot be resolved to a type
    MessagingException cannot be resolved to a type
    Session cannot be resolved to a type
    Session cannot be resolved to a type
    Message cannot be resolved to a type
    MimeMessage cannot be resolved to a type
    InternetAddress cannot be resolved to a type
    Message cannot be resolved
    MimeBodyPart cannot be resolved to a type
    MimeBodyPart cannot be resolved to a type
    MimeBodyPart cannot be resolved to a type
    MimeBodyPart cannot be resolved to a type
    FileDataSource cannot be resolved to a type
    FileDataSource cannot be resolved to a type
    DataHandler cannot be resolved to a type
    Multipart cannot be resolved to a type
    MimeMultipart cannot be resolved to a type
    Transport cannot be resolved

    #262261

    Dani,

    Java 1.4 changed the rules as to how packages beginning in java.* and javax.* get loaded. Specifically, they only get loaded from endorsed directories.
    Please try to copy your libraries to TOMCAT_HOME/common/endorsed or check the variable JAVA_ENDORSED_DIRS in the Tomcat startup script. Some Tomcat’s versions use only this directory as endorsed.

    Snjeza

    #262296

    Using 1.5. Looks like the is something wrong with the tomcat startup scripts

    #262298

    Dani,

    Tomcat 5.5 uses common/endorsed as ‘endorsed’ directory.
    What version do you use?
    Can you check if you copy libraries to common/lib or common/endorsed (these directories already exist in the Tomcat distribution; common/endorsed is empty).

    Snjeza

    #262308

    Found it, when I add the jar files as external jar, for some reasons they are deployed in the WEB-inf/lib directory. If I remove the files after deployment, the code works fine. How can I tell eclipse not to deploy these two files in WEB-INF/lib

    #262313

    Scott Anderson
    Participant

    How can I tell eclipse not to deploy these two files in WEB-INF/lib

    Deployment customization options are detailed in the Advanced section our
    Working with Web Projects quickstart. You can configure the deployment at the workspace or project level so you should be able to cut it down to what you need.

    #262322

    Snjeza,

    I don’t want the external jar to be exported to the WEB-INF/lib. Can’t see a button for this. Maybe I could add the lib to a dependent project to solve the problem

    regards

    Dani

    #262392

    Dani,

    The easiest way to do that is putting the external libs out of WebRoot directory and adding them to Project Build Path.

    Regards

    #262423

    The jar files are not in the Eclipse Project Webroot directory (workspace/myproject/WebContent/WEB-INF/lib). The two jar files are added as external jar files to the project build path.

    The problem is that the deploy mechanism copies the files into the tomcat WEB-INF/lib directory automatically from the external-jar reference in the project build path 🙁

    #262453

    Dani,
    take a look at the preferences dialog:
    MyEclipse/J2EE Project/WebProject on the tab Deployment in the group of checkboxes
    called Library Deployment Policies and uncheck all of them.

    If you do this, you’ll have to copy the nescessary jars to the app server yourself,
    but at your problem should go away.

    best regards

    Manfred

    #262484

    Scott Anderson
    Participant

    Manfred,

    Thanks for the follow up! You’re exactly right all this is configurable as you mentioned. More detail is provided here:
    https://www.genuitec.com/forums/topic/closed-tomcat-5-5-deployment-from-myeclipse/#post-262313

    #263249

    Manfred, thanks for you help. I finally fixed the problem. I changed the configuration as you told me. Configured that way, I don’t have to manually deploy the jar files.
    The jar files required for deployment are in workspace/projectname/WebContent/WEB-INF/lib directory. The javamail jars (activation.jar and mail.jar) are copied to /opt/tomcat/common/lib and added to the buildpath with properties->java build-path->libraries. If I deploy the project, only the files from workspace/projectname/WebContent/WEB-INF/lib are deployed.

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: [Closed] Tomcat 5.5 deployment from MyEclipse

You must be logged in to post in the forum log in