facebook

On a new project a just don’t work! [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #204255 Reply

    gilesp
    Member

    Hi there guys

    This post has three questions to it, so i do hope you’ll bare with me. I’m hoping that they could all be related.

    I’ve started working at a new company that usings any existing directory structure that i would like to incoprorate into myeclipse so i can make use of the beautiful hot deploy and remote debugging features of myeclise. I’ve been using myeclipse for a while now, and have successfully remote debugged on tomcat4/5 and resin.

    This is my first issue: The existing package structure looks fine, and something like this:
    ProjectName
    Source
    my
    company
    project
    <many different source folders>
    web
    javascript
    images
    WEB-INF
    classes
    lib … etc

    Pretty usual. When i create the project and point the source of the project at the existing file structure, i get the usual .myeclipse folder and .classpath, .project ect under the project name in the file system… still fine. However on building the project i sometimes get the above .myeclipse folder and .files added beneath my web package ASWELL. (ie in two places). I also then get a new web folder with associated web-inf stuff… so i end up with this on the file system:
    ProjectName
    Source
    .myeclipse folder
    .classpath
    .project
    my
    company
    project
    <many different source folders>
    web
    javascript
    images
    WEB-INF
    classes
    lib … etc
    <—- all the above i except as normal – but then this –>
    web
    .myeclipse folder
    .classpath
    .project
    companyname
    WEB-INF
    classes
    lib

    Could this be a problem with the way i am setting the project up? The only thing i can think of that i am doing differently is in my project properties i add an exclusion filter to the source path for the web folder… as i don’t want to compile any of the web stuff (ie it’s not source). If i don’t do this… the web folder gets treated as a source package.

    I’ve also made sure that my class build dir is pointing at the correct place.
    I normally just go in and delete these additional folders and things then seem fine.

    Following on from this – having started a project, including necessary jars everything builds fine. However all my jsps have an invalid error. They all seem to be unable to see a specific class that is used in all of them.On opening all of them up, adding a space and resaving the jsps they all compile beautifully. I’m pulling things out of VSS, so thought there could be some strange character inserted into the files…. however, this has happened again and again. On a work machine, and home machine. Could it be that they are read only when checked out ?- No clue !!!

    Right, and now for the hum dinger ! I want to be able to debug all of this stuff. This new company hasn’t been indoctrinated with the joys of myeclipse yet (yet !!!) and so are using inteliJ, with a build in Tomcat plugin. The exact same source tree builds, starts and works perfectly through intelij. I can debug the app. However i can’t seem to get it to work through myeclipse. I’ve tryed tomcat 4 and 5.

    The myeclipse hot deploy function seems to work through – i can see the added web app in the tomecat directory, and all the files being copied across. Tomcat then starts up fine through the start up icons. JDKs has been configured in the preferences panel.

    I’ve checked the classes and paths of the tomcat plugin in intelij and it is using nothing extra on starting the app. On startup intelij opens the console and displays all the app specific parsing getting done on startup… and it all scrolls away fine. However in myeclipse, when tomcat is started all i see in the console is that tomcat has started (ie no app specific stuff shown)

    Does the console in eclipse show application specific logging details? (like intelij does?)

    .. phew …

    Probably too long to make any sense… but frustrating problems on a simple process i’ve done many times before. If you can gleam anything out of that i”d be much appreciated.

    Regards
    Giles

    PS: everything has been tried at least 5 / 6 times, so i know it’s not a dodgy install. I did a clean setup from a home pc, and it still does the same.

    System Setup ——————————-
    Operating System and version: XP
    Eclipse version: 3M6
    Eclipse build id: 200312182000
    Fresh Eclipse install (y/n): Y
    If not, was it upgraded to its current version using the update manager?
    Other installed external plugins:
    Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*: 8
    MyEclipse version: 37RC2
    Eclipse JDK version: jdk1.4.2
    Application Server JDK version: jdk1.4.2
    Are there any exceptions in the Eclipse log file? NO

    – Message Body ——————————-

    #204259

    Scott Anderson
    Participant

    Could this be a problem with the way i am setting the project up?

    It surely sounds like it. MyEclipse web projects are set up in an exploded WAR format. Just create a default one to see. There’s a java source folder and a web root, typically called WebRoot. The classes folder needs to be in WebRoot/WEB-INF/classes. Your JSP’s need to be under the webroot folder somewhere. Those are the basic rules. As a test, can you set up another project in the default format generated by the wizard and then copy your projects artifacts into the appropriate places and see if that deployes ok for you? If that does, then we can start analyzing the differences.

    #204335

    gilesp
    Member

    Hi Scott

    Heres an update – with still no resolution unfortunately 🙁

    I did as requested. Created a default myeclipse project – and then copied my source into the default myeclipse src, and likewise with the web content. Still no joy !

    The one difference i haven’t mentioned is that i am using a custom built mvc pattern. (as opposed to struts) This is the only other major difference i can think of. When starting in intelij – as the container starts up, i can see the custom controller being loaded. (scolling through the console)

    When i try and start tomcat through myeclipse tomcat only spews this out:
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.4

    … a short pause…. and then

    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.4

    again. (ie: no servlets loading up at start up)
    In tomcat 5… i see stuff scrolling, but no mention of the mvc controller servlet. (I think this is my biggest clue !)

    I can also set debuggable break points in the index.jsp… however as soon as it tries to route to the servlet… bamm ! resource not found.

    An interesting point … there are a bunch of properties files that the mvc objects need read on start up. These live in the web-inf/classes dir. If i remove these i get the custom error message from the app – which makes me think that the app must have started up at that point… or else i wouldn’t have received the error message. However if the property files are replaced where they should be, if falls over saying it can’t find the controller servlet…. which should have loaded up on startup.

    I’ve added <load-on-startup>1</load-on-startup> to the web.xml to try and ensure this controller servlet has started up right at the beginning…. makes no difference.

    I suppose my biggest concern is that this works perfectly in intellij – so it can’t be a programatic thing… and has to be some configuration thing. Urgggg !

    Any idea how i can make this horrid thing go away – thereby enabling me to tell everyone here in my new office to go out and buy myeclipse ???

    Cheers guys
    Regards
    Giles

    #204337

    gilesp
    Member

    Hi again guys ….

    Just to confirm… that when starting intellij (sorry, hate to go on about the enemy), but i can definately see the controller servlets being started up.

    XmlMapper: org.apache.catalina.core.StandardWrapper.setName( stopsController)
    XmlMapper: org.apache.catalina.core.StandardWrapper.setServletClass( xxx.company.mvc.StopsControllerServlet)
    XmlMapper: Calling org.apache.catalina.core.StandardContext.addChild StandardWrapper[stopsController]

    No mention of it through the console in myeclipse. Although i do see the context being loaded:
    INFO: Installing web application at context path /stops from URL file:C:\jakarta-tomcat-5.0.19\webapps\stops

    The mvc objects are all jared and sit in the web-inf/lib dir. I’ve tried taking these out and placing them in all three differnet options in the tomcat\paths window (ie:prepend to cp, append to cp, append to lib dir)

    I rekon you now have about as much info as i could can possibly think of !

    Go great brains !

    #204341

    Scott Anderson
    Participant

    Giles,

    Will you manually check on your project’s deployment to see if it is where it belongs? It should be under <tomcat-home>/webapps. If you’re using exploded deployment, there should be a directory in there with all your content in exploded war format. Is everything where it belongs?

    An interesting point … there are a bunch of properties files that the mvc objects need read on start up. These live in the web-inf/classes dir.

    Placing them in web-inf/classes is dangerous because Eclipse owns the class output directory and will clean it out on each project rebuild. You really need to place the property files in the corresponding spot in your java source folder. When Eclipse builds, anything that isn’t java is automatically copied to the build output folder, so this will place them in web-inf/classes automatically for you.

    Can you email us a screenshot (jpg, gif) of your project setup with all the directories expanded so we can have a look at your setup? Please also include your .project file and your .mymetadata file for the project. Also, please include the URL for this thread so I can find it again to post my analysis. 🙂

    #204540

    gilesp
    Member

    Hi Scott

    Sorry for the delay in getting back to you (although i imagine you’ve got your hands pretty full anyway !) I have sent an email to support@genuitec.com with subject:
    For Scott : Reference: https://www.genuitec.com/forums/topic/on-a-new-project-a-just-don-t-work-closed/. This contains the images and other things you wanted. (sorry didn’t know how include these in this thread)

    Here are some things i’ve found out since i last was in contact:

    When i create the project and point the source of the project at the existing file structure, i get the usual .myeclipse folder and .classpath, .project ect under the project name in the file system… still fine. However on building the project i sometimes get the above .myeclipse folder and .files added beneath my web package ASWELL. (ie in two places). I also then get a new web folder with associated web-inf stuff… so i end up with this on the file system:

    I’ve figured out when (not why) the additional .myeclipse, .mymetadata and .project get copied into my web-inf/classes directory. It’s when i do my first build of the project. My output dir is set to <project>/web/WEB-INF/classes. I’ve never seen this behaviour before. (please see image 1)

    If i remove them from the package structure, things are okay. I then do the deploy, and my tomcat5 web apps dir looks like image 2. Looks okay to me.

    Placing them in web-inf/classes is dangerous because Eclipse owns the class output directory and will clean it out on each project rebuild. You really need to place the property files in the corresponding spot in your java source folder. When Eclipse builds, anything that isn’t java is automatically copied to the build output folder, so this will place them in web-inf/classes automatically for you

    Unfortunately this is something i have to live with for now. It’s the horrid existing format. I just normally get them out of vss after a rebuild…. horrid, but not my major problem at the moment. See image 3 for my package structure from within eclipse. Image 4 and 5 are from the windows explorer.

    Please also include your .project file and your .mymetadata file for the project

    These have been included in the email.

    The URL for this thread is:
    https://www.genuitec.com/forums/topic/on-a-new-project-a-just-don-t-work-closed/

    As i think i mentioned before: I’m sure the app has deployed (or part of it) as i can debug some of the intial jsp’s. However as soon as it tries load the controller servlet, if falls over. (see image 6 for: no sign of that controller servlet)

    My web.xml also definately contains a reference for this servlet (see image 7)

    Scott …. mystified !!!

    #204584

    Riyad Kalla
    Member

    Giles,
    This is very strange, and from what I see most likely a project organization issue (very much what you guys already assessed).

    Can you do me a favor and:
    0) Add the load-on-startup tag back to your web.xml file (I noticed in the screenshot it wasn’t there).
    0.5) right-click and validate your web.xml file to make sure its fine
    1) Deploy your app
    2) Start Tomcat 5
    3) Access the controller from a URL (paste the URL here)
    4) Paste the message you get in the browser here, and also paste the error in the console and/or Tomcat files

    Thanks!

    #204661

    gilesp
    Member

    SCOTT : I HAVE GREAT PLEASURE IN ANNOUNCING THE IRRADICATION OF THIS HEENOUS ISSUE !

    From what i can gather the problem appears to have been as horrid / and simple as the incorrect web-context root. MyEclipse makes the default context the same name as the project name (case sensitive)… So all the tests i’ve being doing… creating sample test app names, creating different contexts – from within myeclipse have essentially revolved around the incorrect DEFINED context for the application.

    I have subsequently been told that there is a properties file within the app that defines the web-context ! Bugger. In essence a weeks pain because of a small ‘s’ and not a big ‘S’. So my issue has been resolved -> thank you for your help !

    My project actually involves some ejb’s – and i’ve managed to quite happily fire up weblogic within myeclipse. I have a few issues around this (as my project isn’t an ejb project – but a web project, so i can debug, just can’t hot deploy.) … phew but i think a question for another time (and a good search through the forums)… i feel like i need to do some billable work again !

    Thanks Scott !

    #204671

    Riyad Kalla
    Member

    Giles,
    We are glad it is working now. Thank you for closing the loop with us.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: On a new project a just don’t work! [Closed]

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