For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 13 replies, 4 voices, and was last updated 18 years, 8 months ago by
Daniel Haensse.
-
AuthorPosts
-
Daniel HaensseMemberHi,
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
November 19, 2006 at 7:08 pm #262250
support-snjezaMemberDani,
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
November 19, 2006 at 10:49 pm #262255
Daniel HaensseMemberThat 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 resolvedNovember 20, 2006 at 4:36 am #262261
support-snjezaMemberDani,
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
November 20, 2006 at 2:07 pm #262296
Daniel HaensseMemberUsing 1.5. Looks like the is something wrong with the tomcat startup scripts
November 20, 2006 at 2:35 pm #262298
support-snjezaMemberDani,
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
November 20, 2006 at 3:20 pm #262308
Daniel HaensseMemberFound 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
November 20, 2006 at 3:28 pm #262313
Scott AndersonParticipantHow 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.November 21, 2006 at 12:09 am #262322
Daniel HaensseMemberSnjeza,
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
November 21, 2006 at 11:11 am #262392
support-snjezaMemberDani,
The easiest way to do that is putting the external libs out of WebRoot directory and adding them to Project Build Path.
Regards
November 21, 2006 at 1:44 pm #262423
Daniel HaensseMemberThe 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 🙁
November 22, 2006 at 9:14 am #262453
Manfred Rudolf BihyMemberDani,
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
November 22, 2006 at 1:24 pm #262484
Scott AndersonParticipantManfred,
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-262313December 10, 2006 at 8:39 am #263249
Daniel HaensseMemberManfred, 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. -
AuthorPosts