Changes between Initial Version and Version 1 of DespoinaLog/2012/02/13


Ignore:
Timestamp:
2012-02-13T13:58:43+01:00 (13 years ago)
Author:
antonak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DespoinaLog/2012/02/13

    v1 v1  
     1On tomcat -eclpse problem : followed step in email :
     2
     3The problem has been bugging me so I've been fiddling with Tomcat and Eclipse since I got home.. and learned quite a lot since. I believe it was Morris who said that breaking things can sometimes be good, eh ;-) Though I was not the one to delete those files, I think the reason was that they are different for everyone due to project setups, and they accidentally got committed once in a while. Which is very annoying when you update your code, and see your build suddenly broken. So they are now ignored from SVN, meaning you have to set it up once, and be done for life.
     4
     5Anyway, I found out that the really important files when it comes to developing with Tomcat via Eclipse are:
     6
     7.settings/org.eclipse.wst.common.component = Mapping of classpath source folders to /WEB-INF/classes, /WebContent to /, and imported projects (molgenis) to a generated JAR in /WEB-INF/lib
     8.classpath = Also annotates which JARs (including those from imported projects) are to be exported in /WEB-INF/lib (next to the regular classpath source folders etc)
     9
     10And now the useful part, how to setup your Tomcat build just right:
     11
     121. Run the 'update-eclipse' function of your projects 'build_X.xml' Ant script (Run as -> Ant build... "update-eclipse" -> Run), this will setup your project classpath source folders.
     13
     142. Go 'Build Path -> Configure Build Path...' and
     152.1 under Source: verify your source folders, e.g. modules / generated stuff / the app.
     162.2 under Projects: import 'molgenis' here
     172.3 under Libraries: import the minimal set of libraries here from both molgenis and molgenis_apps. (some are duplicate and Tomcat will not start up) As a suggestion you could start with the ones in this list: http://www.molgenis.org/svn/molgenis_apps/trunk/xqtl_jar.xml plus commons-lang-2.5.jar (required for Tomcat logger) Also make sure you have selected: Apache Tomcat vX.X, EAR Libraries, JRE System Library, Web App Libraries.
     182.4 under Order and Export: Select All.
     19
     20Press OK and let it refresh / build etc.
     21
     223. Go again to 'Build Path -> Configure Build Path...', select Deployment Assembly. Here you should see 4 kinds of things going on:
     233.1 All of your source folders (modules and apps) are mapped to WEB-INF/classes
     243.2. /WebContent is mapped to /
     253.3 All of the libraries you selected in your build path are mapped to WEB-INF/lib
     263.4 The molgenis project is mapped to /WEB-INF/lib/molgenis.jar
     27
     28If not, fix it. Next:
     29
     304. Make your WEB-INF/web.xml like so:
     31
     32<web-app>
     33    <!-- FrontController mapping for Tomcat -->
     34    <servlet>
     35        <servlet-name>FrontController</servlet-name>
     36        <servlet-class>app.servlet.FrontController</servlet-class>
     37    </servlet>
     38    <servlet-mapping>
     39        <servlet-name>FrontController</servlet-name>
     40        <url-pattern>/*</url-pattern>
     41    </servlet-mapping>
     42</web-app>
     43
     445. Save, refresh, clean, build, and deploy on Tomcat. It should work.
     45
     46The thing I have not figured out yet is how to change the deployname when running directly from the molgenis_apps project. It seems you must use 'molgenis_apps' as your application URL. This works fine until you e.g. try out the R API, which uses your configured application name (e.g. animaldb, xqtl, lifelinescatalogue, etc) to call back, which will fail.
     47
     48Another tiny thing is that you must map to /* in web.xml, which means you cannot call the application with http://localhost:8080/molgenis_apps - you must add a trailing slash or Tomcat doesn't get it, like so: http://localhost:8080/molgenis_apps/
     49
     50Sorry for the massive email, I hope it helps.. comments/questions always welcome :) have a nice weekend,
     51
     52Best regards,
     53Joeri
     54
     55
     56NEW error coming out :
     57.
     58{{{
     59
     60{{{
     61javax.servlet.ServletException: Error instantiating servlet class app.servlet.FrontController
     62        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     63        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     64        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
     65        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     66        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     67        java.lang.Thread.run(Thread.java:680)
     68}}}
     69
     70}}}