Tuesday, 15 July 2014

tomcat - Java Dynamic web project classpath -



tomcat - Java Dynamic web project classpath -

i have project in meantime runs locally on tomcat i'm planning deploy server in future. have few questions:

i'm using tomcat-jdbc.jar. how should include jar in project? re-create web-inf/lib or add together library reference tomcat? latter portable? can utilize jar if server i'm deploying using jetty? when added jre, eclipse asked me point jre path. line added in classpath

classpathentry kind="con" path="org.eclipse.jdt.launching.jre_container"

how eclipse figure out line jre at?

when project deployed server, how project hierarchy like?

my guess is:

<project name> ----<build> (.class files) ----<webcontent> --------<meta-inf> ------------manifest.mf --------<web-inf> ------------<lib> ----------------external_jar.jar ------------web.xml ---------index.html

is correct? if so, how runtime know find jre? or tomcat-jdbc.jar in tomcat installation folder?

your application needs next 3 types of "resources"

system resources: jre classes, extensions/libraries provided server deploy on. your dependencies: libraries use, common-utils, poi etc. these jar files go in web-inf/lib folder your classes. these deployed war file @ web-inf/classes

so, reply questions:

if deploying tomcat, tomcat-jdbc.jar provided. take care of version though. if prod server tomcat dev jetty, need provide jar in local ide, not export in war file. if developing on tomcat , deploying on other server, jar has bundled war file (web-inf/lib folder). dev , prod servers need not same, take care of jre version , dependency on prod server provided libraries. jre configurable setting server , ide (eclipse) project hierarchy correct, deploy war file, build folder exported in web-inf/classes. can verify opening war file zip editor.

regarding portability of tomcat-jdbc.jar unfortunately depends on tomcat library , version. there might more dependencies of jar file might cause problems later on. recommend not relying on jar unless plan deploy on tomcat.

java tomcat classpath

No comments:

Post a Comment