facebook

Maven+Hibernate+Spring MVC

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #309797 Reply

    Tried the following:

    1) Create new Maven project
    2) Changed JDK to workspace default, Java compiler to 1.6
    3) Changed junit 3.8.1 to newest junit version (pom.xml)
    4) Add Spring Code Generation Capabilities
    4a) Spring Nature enabled
    4b) Left everything else default enabled (Context root: /src/main/webapp, seems to be the maven default?!)
    5) Created a new Model package, and added a domain object (for the sake lof the example: MyUser) , added some attributes, no relationships so far
    6) Scaffold Spring MVC CRUD Application from this model package
    7) Couldn’t deploy the project, so added Web app capabilities
    7a) J2EE5, added libraries to the project, genreated web.xml
    8) Deployed it to Apache Tomcat
    9) Run -> Requested resource not available (404)
    Looked in tomcat console and found:

    
    14.07.2010 02:09:24 org.apache.catalina.startup.HostConfig checkResources
    INFO: Reloading context [/MyExampleProject]
    14.07.2010 02:09:25 org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(C:\Users\Dominik Rauch\Workspaces\MyEclipse for Spring 8.5\.metadata\.me_tcat\webapps\MyExampleProject\WEB-INF\lib\geronimo-servlet_2.5_spec-1.2.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    14.07.2010 02:09:25 org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(C:\Users\Dominik Rauch\Workspaces\MyEclipse for Spring 8.5\.metadata\.me_tcat\webapps\MyExampleProject\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    

    Additionally / for the worst: If I type “mvn clean compile” into the console, I get an error that JMS-1.1.jar can’t be read.

    (it’s definitely there)

    Is there something to take care of after using all the wizards to jumpstart a project environment for this setting? Is it even possible? Did I make any errors?

    I’m currently evaluating the new MyEclipse for Spring IDE for use in our projects and hope this will release us from doing everything per hand … additionally we want to use Maven now, so the new IDE has to support that too…

    Hope your IDE can do that, hope you can help me : )

    Thanks in advance & best regards,
    D. R.

    PS: Sorry for bad English, I’m not a native speaker.

    #309814 Reply

    Heflin Hogan
    Member

    For evaluation purposes, I’d recommend instead of using the Java Maven Project from the New Projects wizard, try the Web Project and check the Add Maven support box. After that, try the scaffolding again. The project should deploy without error.

    Regards,
    Heflin

    #309821 Reply

    Wow, thanks! Works fine.

    Hope I didn’t miss any tutorials here on the site describing the same thing…

    Thanks again and have a nice day!

    #309852 Reply

    davemeurer
    Member

    I wanted to also post to this thread with the steps to get a Java Maven project working as well. We’ve recently worked with a current customer to come up with these steps, so I thought this would be helpful to others who need to use the Java Maven project both inside and outside of MyEclipse for Spring. For example, if you have a separate team that is in charge of project builds, and their standard is command-line maven, these steps will help you achieve that goal.

    1. Create Java Maven Project
    a. Add /src/main/resources folder (this is Maven default folder for resources)
    b. Add /src/main/webapp folder (this is the Maven default folder for web root)
    c. Add resources folder as source folder (using Build Path > Source)
    d. Change project compiler settings to something greater than 1.4

    2. The default pom file that’s created for Java Maven projects will create a jar file. You can modify it to generate a war file. See packaging and build/plugins in attached POM file. The pom file should only be modified after the initial scaffolding, otherwise ME4S will alter it.

    3. m2Eclipse resolves dependencies different than Maven command-line. If you have another team needing to use command-line Maven on your projects, we recommend using Maven command-line tool from within Eclipse (Preferences > MyEclipse > Maven4MyEclipse > Maven > Installations). This way MyEclipse for Spring folks are using the samething the command-line folks are using.

    You should be able to run maven commands from command-line (i.e. mvn package, mvn tomcat:run). You may need to create some new run configurations for the commands that don’t already exist in MyEclipse. One thing to note is that you won’t run the app by adding to MyEclipse Tomcat. (That’s the consequence of using Java Maven Project).

    Finally, another item to note is that you may want to trim the pom.xml file if you are not using all the technologies provided by ME4S. The attached pom.xml file provides a thin pom.xml file that works with MVC or WebFlow.

    HTH!

    Attachments:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Maven+Hibernate+Spring MVC

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