Announcement Announcement Module
Collapse
No announcement yet.
STS build paths and java class libraries Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS build paths and java class libraries

    I recently downloaded the latest version of sts and went through the requisite updates.

    When trying to build app using mostly POJOs which
    Import javax.persistence classes I notice that the javax libraries
    Cannot be resolved. Isn't't the javax library a standard lib
    That should alrready exist in the main STS build path? Do I have to download this
    Lib seperately? Which standard java class libs are already included in sts?
    Are there any specific updates I can do to ensure that I have as many
    Java libraries as possible? Would greatly appreciate any advice. Thanks!

  • #2
    I did a quick google search for you. I don't think this is part of a standard JDK. It is part of Java EE SDK.

    (FYI: here is a link to the search: https://www.google.com/search?client...utf-8&oe=utf-8)

    The following seems like useful information for you:
    http://stackoverflow.com/questions/3...-j2ee-jar-from

    The j2ee.jar is one that you will need. Note however that, from what I googled, I think this jar only contains 'stubs' and interfaces. You will also need something like hibernate or something similar to provide an actual implementation (assuming you want to run your code rather than just compile it :-)

    Kris

    Comment


    • #3
      Kris,

      Thanks a lot for your help. I'll look for the right jars and let you know. From what I'm also 'googling' it seems like the right Hibernate version is the one from JBoss (http://download.jboss.org/jbosstools/updates).

      However another problem is STS doesnt let me install any hibernate updates due to a dependency conflict so I'm not sure which is the right version of Hibernate to use and how best to install the correct libraries on STS.

      I really thought this application on Spring uses standard java classes but seems like finding the right libraries can be quite tricky on Spring framework. Would greatly appreciate some more advice. Many thanks again!

      Comment


      • #4
        The reason why it is difficult is that you are trying to build a project and set it all up yourself.
        Most people are probably using tools like maven to help install dependencies.

        Rather than start from scratch it may be easier for you to use a framework like spring-roo to generate most of the app you want to build for you. Or at least use a sample app. (There are some template projects in STS that should be relatively easy to get started with).

        To get to the templates do
        "File >> New >> Project"

        Then search for 'template'. You will find "Spring Template Project".
        Select that and see which one of the templates looks most like what you are trying to build.

        If you are having trouble with using the templates... (as you can imagine, they do get out of date some times :-) please let us know. Making these templates work well for new users is something that STS team is actively working on at the moment.

        Kris

        Comment


        • #5
          I followed your advice and set up a project using the Spring MVC template. So first step was simply to test the generated application. I tried running the index.jsp and got the following error (which leads me to think there is something wrong with my STS configuration):

          java.lang.ClassNotFoundException: org.apache.catalina.filters.SetCharacterEncodingFi lter
          at org.aspectj.weaver.bcel.ExtensibleURLClassLoader.f indClass(ExtensibleURLClassLoader.java:54)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)
          at org.apache.catalina.core.DefaultInstanceManager.lo adClass(DefaultInstanceManager.java:405)
          at org.apache.catalina.core.DefaultInstanceManager.lo adClassMaybePrivileged(DefaultInstanceManager.java :397)
          at org.apache.catalina.core.DefaultInstanceManager.ne wInstance(DefaultInstanceManager.java:118)
          at org.apache.catalina.core.ApplicationFilterConfig.g etFilter(ApplicationFilterConfig.java:252)
          at org.apache.catalina.core.ApplicationFilterConfig.s etFilterDef(ApplicationFilterConfig.java:372)
          at org.apache.catalina.core.ApplicationFilterConfig.< init>(ApplicationFilterConfig.java:98)
          at org.apache.catalina.core.StandardContext.filterSta rt(StandardContext.java:4562)
          at org.apache.catalina.core.StandardContext$2.call(St andardContext.java:5240)
          at org.apache.catalina.core.StandardContext$2.call(St andardContext.java:5235)
          at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)

          And the result was a 404 error on my IE web browser

          Comment


          • #6
            Also I downloaded Maven and installed the dependency libraries in my original application, but can't seem to find the right information on how to use Maven to install the dependencies. I prefer your suggestion of using Spring templates but would still like to know how to properly use Maven in future. THANK YOU!

            Comment


            • #7
              Sorry for not responding sooner. Perhaps the templates are not right for you. It depends what you are trying to do.
              But someone does need to look into the error you posted. I will follow up on it.

              EDIT: I raised this Jira issue about template project problem (https://issuetracker.springsource.com/browse/STS-2590)

              Regards to using maven. I am not really an expert on those tools and don't use them myself. But I have to somewhat agree with you that finding info on maven eclipse support can be somewhat daunting. The docs for m2e are very poor.

              There are some tutorials out there on how to use maven in the commandline which is not that bad. If you are new to maven I suggest you should start with that and familiarize yourself with how maven works and its basic concepts.

              Here is just one suggestion:
              http://maven.apache.org/guides/getti...ted/index.html

              Often with maven and m2e (maven support for eclipse) you will need to find maven user forums / lists and ask questions there to get answers. The docs are not always up-to-date or complete.

              Kris
              Last edited by Kris De Volder; Apr 23rd, 2012, 10:50 AM.

              Comment


              • #8
                Kris,

                Your comments are very helpful and I greatly appreciate your help. What I'm trying to do is to build an enterprise application starting with a document management system (or CMS). The two options are either a simple structure using POJOs, xml and Tomcat OR a framework like Spring. I must say from limited experience that Spring doesn't appear to be easy to understand. Getting the templates to work seems to be quite tricky and there is little sample code for how to correctly build end-to-end applications like CMS. I will try my luck with the maven and other documentation which you kindly provided. For now, I simply want to be able to run the Maven / Hibernate sample and hoppefully I'll be able to figure out how to build customs apps in Spring. I definitely see the advantages of an open source framework like Spring, but the learning curve and available material has to make sense I think. Would welcome and other any other advice on the best way to learn and master Spring. Many thanks, J

                Comment


                • #9
                  You probably already found this yourself. But just in case, this is the default 'getting started with spring' link.

                  http://www.springsource.org/get-started

                  Kris

                  Comment


                  • #10
                    BTW: I tried the mvc sample app and it worked for me.
                    You mentioned 'index.jsp' however. I don't have an index.jsp in my 'Spring MVC Sample'.
                    Makes me wonder... Was I using the same template as you?

                    Kris

                    Comment

                    Working...
                    X