[ 
https://issues.apache.org/jira/browse/SLING-2350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13183862#comment-13183862
 ] 

David Gonzalez commented on SLING-2350:
---------------------------------------

I was able to resolve: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory 
by adding slf4j-api and slf4j-log4j12 as plugin depdencies in my pom.xml

  <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>maven-jspc-plugin</artifactId>
                <version>2.0.6-SNAPSHOT</version>               
                  ...                
                <dependencies>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>1.5.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                        <version>1.5.2</version>
                    </dependency>  
                  
                </dependencies>
            </plugin>


I also needed to add a log4j.properties file to the maven-jspc-plugin under 
/src/main/resources else i received a numbe of warnings about log4j not being 
properly initialized (I couldnt put them in my proj's /src/main/resources, it 
had to be in the maven-jspc-plugin project's).

I am now running into a NullPointerException:

ava.lang.NullPointerException
        at 
org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:361)
        at org.apache.sling.maven.jspc.JspcMojo.processFile(JspcMojo.java:359)
        at 
org.apache.sling.maven.jspc.JspcMojo.executeInternal(JspcMojo.java:315)
        at org.apache.sling.maven.jspc.JspcMojo.execute(JspcMojo.java:227)


I've included the entire maven build output here: 
https://gist.github.com/1592959

It looks like in Compiler.java its throwing the exception because jsw is null:

        final long lastModifiedTest = jsw.getLastModificationTest();

In JspMojo,processFile the Compiler object is created, however i *think* the 
only way to set the JspServletWrapper in the Compiler is by calling its:

    public void init(JspCompilationContext ctxt, JspServletWrapper jsw) 

And it's not, thus its null.

I looked through code and im not sure I understand what would be needed to 
create a JspServletWrapper obj properly, or if its even needed (is 
jsw.getLastModificationTest even truly needed?)

Any thoughts around this?
                
> Sling Maven JSPC Plugin depends on legacy Sling API lib which does not 
> support adaptable SlingHttpServletRequest objects
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2350
>                 URL: https://issues.apache.org/jira/browse/SLING-2350
>             Project: Sling
>          Issue Type: Improvement
>          Components: Maven Plugins and Archetypes
>    Affects Versions:  Maven JSPC Plugin 2.0.4
>         Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
> Maven home: /usr/share/maven
> Java version: 1.6.0_29, vendor: Apple Inc.
> Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x", version: "10.7.2", arch: "x86_64", family: "mac"
>            Reporter: David Gonzalez
>            Assignee: Carsten Ziegeler
>              Labels: maven-bundle-plugin
>         Attachments: jspc-test.zip, pom.xml, pom.xml.diff
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Buiding Sling-based project using the Maven JSPC Plugin but am getting 
> compilation errors because SlingHttpServletRequest object doesn't have 
> .adaptTo(...) defined.
> Latest Sling API docs state:
>       Starting with Sling API 2.0.6, this [SlingHttpServletRequest] interface 
> also extends the Adaptable interface.
> Sling Maven JSPC Plugin 2.0.4-incubator plugin [1] depends on  "Sling 
> Scripting 2.0.2-incubator" [2] which in turn depends on "Sling API  
> 2.0.2-incubator" which is older than 2.0.6 thus no Adaptable support.
> [1] 
> http://svn.apache.org/repos/asf/sling/tags/maven-jspc-plugin-2.0.4-incubator/pom.xml
> [2] 
> http://svn.apache.org/viewvc/sling/tags/org.apache.sling.scripting.jsp-2.0.2-incubator/pom.xml?view=markup

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to