Announcement Announcement Module
Collapse
No announcement yet.
Spring security sample tutorial throws error within STS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring security sample tutorial throws error within STS

    Hi Folks,

    Sorry if this is a repetitive post. I followed Rob's instructions (http://rwinch.blogspot.com/2011/03/r...=1342135304433 on getting the source from git and then use gradlew to build the code. After that I import the project into STS and try to run the tutorial sample. I get the following error below when I try to deploy it using tomcat or vFabric Server. However when I just copy the war and put it in tomcat's webapps directory and run tomcat outside of STS, I get no issues. I also verified that the WEB-INF/lib has the jstl1.2.jar file. I kind of want to work with Spring Security and STS together. Any inputs will be greatly appreciated.

    My env: Mac OSX Snow Leopard 10.6.8 (latest), Java 1.6, STS 2.9.2.

    org.apache.jasper.JasperException: /index.jsp(3,61) Unable to read TLD "META-INF/c.tld" from JAR file "file:/Users/arnabsinha/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/spring-security-samples-tutorial/WEB-INF/lib/jstl-1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
    org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:218)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<ini t>(TagLibraryInfoImpl.java:183)
    org.apache.jasper.compiler.Parser.parseTaglibDirec tive(Parser.java:386)
    org.apache.jasper.compiler.Parser.parseDirective(P arser.java:450)
    org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1397)
    org.apache.jasper.compiler.Parser.parse(Parser.jav a:130)
    org.apache.jasper.compiler.ParserController.doPars e(ParserController.java:255)
    org.apache.jasper.compiler.ParserController.parse( ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:185)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:354)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:334)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:321)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:592)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:328)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)

  • #2
    Which version of the code are you importing? If you are using 3.1.1+ (i.e. master) you should use the Gradle Eclipse tools to import it.

    Comment


    • #3
      Rob, thank you for responding. I am using Gradle Eclipse tool to import the sources to the workspace. It seems like I have a problem with the WTP jars related to JSTL. Not sure how to go about it at this point.

      Comment


      • #4
        Which version of Gradle Eclipse are you using and which version of the code are you trying to import? What jars show up in your lib folder of the war? You should find the deployed app at <WORKSPACE_LOCATION>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

        Comment


        • #5
          ------------------------------------------------------------
          Gradle 1.0
          ------------------------------------------------------------

          Gradle build time: Tuesday, June 12, 2012 12:56:21 AM UTC
          Groovy: 1.8.6
          Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
          Ivy: 2.2.0
          JVM: 1.6.0_33 (Apple Inc. 20.8-b03-424)
          OS: Mac OS X 10.6.8 x86_64

          I checked the build.gradle file for version for all projects - version = '3.1.2.CI-SNAPSHOT'

          I see the following jars in my WEB-INF/lib:

          antlr-2.7.7.jar
          aopalliance-1.0.jar
          asm-3.2.jar
          asm-analysis-3.2.jar
          asm-commons-3.2.jar
          asm-tree-3.2.jar
          asm-util-3.2.jar
          aspectjrt-1.6.10.jar
          aspectjweaver-1.6.10.jar
          cglib-nodep-2.2.jar
          commons-codec-1.3.jar
          commons-collections-3.2.jar
          commons-lang-2.5.jar
          commons-logging-1.1.1.jar
          ehcache-1.6.2.jar
          groovy-1.7.10.jar
          groovy-all-1.7.5.jar
          hamcrest-core-1.1.jar
          hamcrest-core-1.2.jar
          hsqldb-1.8.0.10.jar
          javassist-3.16.1-GA.jar
          jcip-annotations-1.0.jar
          jcl-over-slf4j-1.6.1.jar
          jsp-api-2.0.jar
          jsr250-api-1.0.jar
          jstl-1.2.jar
          junit-4.7.jar
          junit-4.8.2.jar
          junit-dep-4.8.2.jar
          logback-classic-0.9.29.jar
          logback-core-0.9.29.jar
          mockito-all-1.9.0.jar
          mockito-core-1.8.5.jar
          objenesis-1.0.jar
          objenesis-1.2.jar
          openid4java-nodeps-0.9.6.jar
          powermock-api-mockito-1.4.12.jar
          powermock-api-support-1.4.12.jar
          powermock-core-1.4.12.jar
          powermock-module-junit4-1.4.12.jar
          powermock-module-junit4-common-1.4.12.jar
          powermock-reflect-1.4.12.jar
          servlet-api-2.5.jar
          slf4j-api-1.6.1.jar
          spock-core-0.5-groovy-1.7.jar
          spring-aop-3.0.7.RELEASE.jar
          spring-asm-3.0.7.RELEASE.jar
          spring-beans-3.0.7.RELEASE.jar
          spring-context-3.0.7.RELEASE.jar
          spring-context-support-3.0.7.RELEASE.jar
          spring-core-3.0.7.RELEASE.jar
          spring-expression-3.0.7.RELEASE.jar
          spring-jdbc-3.0.7.RELEASE.jar
          spring-ldap-core-1.3.1.RELEASE.jar
          spring-security-acl.jar
          spring-security-config.jar
          spring-security-core.jar
          spring-security-crypto.jar
          spring-security-taglibs.jar
          spring-security-web.jar
          spring-test-3.0.7.RELEASE.jar
          spring-tx-3.0.7.RELEASE.jar
          spring-web-3.0.7.RELEASE.jar
          spring-webmvc-3.0.7.RELEASE.jar

          Comment


          • #6
            Based upon the error message and the fact that the jstl jar is there, it appears the jstl jar may be corrupted. Try deleting the jstl jar as described on SO (another SO).

            Comment


            • #7
              Rob: I replaced the jstl-1.2.jar with a working copy from another project in my system. It still didn't work. I also tried to delete the servlet-api-2.5.jar and that didn't help either.

              I am out of ideas at this point.

              Comment


              • #8
                Try renaming your local maven repository or commenting out the mavenLocal() entry in build.gradle

                Comment


                • #9
                  I want to clarify something, because I am not sure it got across the first time. Are you using ./gradlew eclipse or are you using Gradle Eclipse? I mentioned this briefly in my response on the blog, but you must use the Gradle Eclipse to build 3.1.1 and later.

                  When the code was updated to Gradle 1.0, a number of the workarounds that were added to the projects to get it to work with gradlew eclipse were removed since they did not work with the update to Gradle 1.0. Gradle Eclipse removes the need for most of the workarounds so it is required for now. I will look into getting gradlew eclipse to work as soon as I take care of some of the higher priority tickets.

                  Comment


                  • #10
                    Rob: that was it. I was using ./gradlew to build and not Gradle Eclipse. Once I installed the Gradle plugin all worked satisfactorily.

                    Thank you very much. Appreciate your patience.

                    Comment


                    • #11
                      Thank you for your patience as well. I created SEC-2009 to ensure that support for ./gradlew eclipse is added back.

                      Comment


                      • #12
                        Hi all,

                        I am also having some trouble getting the sample tutorial to work. Admittedly, today is my first time importing a Git project or executing a Gradle script, so I'm probably missing a step (sorry in advance)! In any case, following the same walkthrough, I obtained the source from git then attempted to import using the Gradle Plugin by browsing to the root folder (../spring-security) and clicking "Build Model". The build fails with the following message:

                        * What went wrong:
                        A problem occurred evaluating root project 'spring-security'.
                        Cause: Could not find property 'ext' on root project 'spring-security'.

                        ...

                        Caused by: groovy.lang.MissingPropertyException: Could not find property 'ext' on root project 'spring-security'.
                        at org.gradle.api.internal.AbstractDynamicObject.prop ertyMissingException(AbstractDynamicObject.java:43 )
                        at org.gradle.api.internal.AbstractDynamicObject.getP roperty(AbstractDynamicObject.java:35)
                        at org.gradle.api.internal.CompositeDynamicObject.get Property(CompositeDynamicObject.java:54)
                        at org.gradle.api.internal.project.DefaultProject_Dec orated.getProperty(Unknown Source)
                        at build_1numtpo3jc682r7jto6rfrhvqb$_run_closure1.doC all(C:\Users\john.rodriguez\git\spring-security\build.gradle:7)
                        at org.gradle.util.ConfigureUtil.configure(ConfigureU til.java:136)
                        at org.gradle.util.ConfigureUtil.configure(ConfigureU til.java:85)
                        at org.gradle.api.internal.project.AbstractProject.co nfigure(AbstractProject.java:866)
                        at org.gradle.api.internal.project.AbstractProject.co nfigure(AbstractProject.java:871)
                        at org.gradle.api.internal.project.AbstractProject.al lprojects(AbstractProject.java:858)
                        at org.gradle.api.internal.BeanDynamicObject.invokeMe thod(BeanDynamicObject.java:158)
                        at org.gradle.api.internal.CompositeDynamicObject.inv okeMethod(CompositeDynamicObject.java:93)
                        at org.gradle.api.internal.project.DefaultProject_Dec orated.invokeMethod(Unknown Source)
                        at org.gradle.groovy.scripts.BasicScript.methodMissin g(BasicScript.groovy:72)
                        at build_1numtpo3jc682r7jto6rfrhvqb.run(C:\Users\john .rodriguez\git\spring-security\build.gradle:5)
                        at org.gradle.groovy.scripts.internal.DefaultScriptRu nnerFactory$ScriptRunnerImpl.run(DefaultScriptRunn erFactory.java:52)
                        ... 56 more

                        My env:
                        Windows 7 Enterprise SP1
                        Java 1.6
                        STS 2.9.2.RELEASE
                        STS Gradle Integration 2.9.0.201203010842-RELEASE

                        Any ideas?

                        Comment


                        • #13
                          It sounds like the incorrect Gradle version is being used (it should be using Gradle 1.0). Check your Gradle settings to see if it is using "Gradle Wrapper's Default".

                          Comment


                          • #14
                            That did the trick. Thanks!

                            Comment


                            • #15
                              one minor side note: when I run the "spring-security-config" unit tests as in the screencast, I get the following stack trace. Is my config still off?

                              org.springframework.ldap.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for SearchRequest
                              baseDn : '0.9.2342.19200300.100.1.1=ben,2.5.4.11=people,0.9 .2342.19200300.100.1.25=springframework,0.9.2342.1 9200300.100.1.25=org'
                              filter : '(2.5.4.0=*)'
                              scope : base object
                              typesOnly : false
                              Size Limit : no limit
                              Time Limit : no limit
                              Deref Aliases : deref Always
                              attributes :
                              : Attempt to search under non-existant entry: uid=ben,ou=people,dc=springframework,dc=org]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for SearchRequest
                              baseDn : '0.9.2342.19200300.100.1.1=ben,2.5.4.11=people,0.9 .2342.19200300.100.1.25=springframework,0.9.2342.1 9200300.100.1.25=org'
                              filter : '(2.5.4.0=*)'
                              scope : base object
                              typesOnly : false
                              Size Limit : no limit
                              Time Limit : no limit
                              Deref Aliases : deref Always
                              attributes :
                              : Attempt to search under non-existant entry: uid=ben,ou=people,dc=springframework,dc=org]; remaining name 'uid=ben,ou=people'
                              at org.springframework.ldap.support.LdapUtils.convert LdapException(LdapUtils.java:174)
                              at org.springframework.ldap.core.LdapTemplate.execute WithContext(LdapTemplate.java:810)
                              at org.springframework.ldap.core.LdapTemplate.execute ReadOnly(LdapTemplate.java:793)
                              at org.springframework.ldap.core.LdapTemplate.lookup( LdapTemplate.java:834)
                              at org.springframework.security.config.ldap.LdapServe rBeanDefinitionParserTests.embeddedServerCreationC ontainsExpectedContextSourceAndData(LdapServerBean DefinitionParserTests.java:32)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                              at java.lang.reflect.Method.invoke(Method.java:597)
                              at org.junit.runners.model.FrameworkMethod$1.runRefle ctiveCall(FrameworkMethod.java:44)
                              at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
                              at org.junit.runners.model.FrameworkMethod.invokeExpl osively(FrameworkMethod.java:41)
                              at org.junit.internal.runners.statements.InvokeMethod .evaluate(InvokeMethod.java:20)
                              at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
                              at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:76)
                              at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:50)
                              at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
                              at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
                              at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
                              at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
                              at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
                              at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
                              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
                              at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
                              Caused by: javax.naming.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for SearchRequest
                              baseDn : '0.9.2342.19200300.100.1.1=ben,2.5.4.11=people,0.9 .2342.19200300.100.1.25=springframework,0.9.2342.1 9200300.100.1.25=org'
                              filter : '(2.5.4.0=*)'
                              scope : base object
                              typesOnly : false
                              Size Limit : no limit
                              Time Limit : no limit
                              Deref Aliases : deref Always
                              attributes :
                              : Attempt to search under non-existant entry: uid=ben,ou=people,dc=springframework,dc=org]; remaining name 'uid=ben,ou=people'
                              at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.jav a:3066)
                              at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:2987)
                              at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:2794)
                              at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:10 11)
                              at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup (ComponentContext.java:526)
                              at com.sun.jndi.toolkit.ctx.PartialCompositeContext.l ookup(PartialCompositeContext.java:159)
                              at com.sun.jndi.toolkit.ctx.PartialCompositeContext.l ookup(PartialCompositeContext.java:148)
                              at javax.naming.InitialContext.lookup(InitialContext. java:392)
                              at org.springframework.ldap.core.LdapTemplate$10.exec uteWithContext(LdapTemplate.java:836)
                              at org.springframework.ldap.core.LdapTemplate.execute WithContext(LdapTemplate.java:807)
                              ... 26 more

                              Comment

                              Working...
                              X