You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Dyblast (JIRA)" <ji...@apache.org> on 2011/02/06 23:09:30 UTC

[jira] Issue Comment Edited: (FELIX-2825) maven-ipojo-plugin & WAR

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

Dyblast edited comment on FELIX-2825 at 2/6/11 10:09 PM:
---------------------------------------------------------

I have found the issue...
the class is correctly generated but it never inject into the final war...
Indeed
Pojoization.java:382
                // If the class was manipulated, write out the manipulated
                // version of the bytecode
                if (m_classes.containsKey(curEntry.getName())) {
                    JarEntry je = new JarEntry(curEntry.getName());
                    byte[] outClazz = (byte[]) m_classes.get(curEntry.getName());
                    if (outClazz != null && outClazz.length != 0) {
                        jos.putNextEntry(je); // copy the entry header to jos
                        jos.write(outClazz);

So the program check if there is a class corresponding to a directory entry ... for example
m_classes = {com/truc/blabla.class} and curEntry = WEB-INF/classes/com/truc/blabla.class
So the orignal class is copied and not replaced.

Small ugly fix: if (m_classes.containsKey(curEntry.getName()) || m_classes.containsKey("WEB-INF/classes/" + curEntry.getName())) {

      was (Author: dyblast):
    I have found the issue...
the class is correctly generated but it never inject into the final war...
Indeed
Pojoization.java:382
                // If the class was manipulated, write out the manipulated
                // version of the bytecode
                if (m_classes.containsKey(curEntry.getName())) {
                    JarEntry je = new JarEntry(curEntry.getName());
                    byte[] outClazz = (byte[]) m_classes.get(curEntry.getName());
                    if (outClazz != null && outClazz.length != 0) {
                        jos.putNextEntry(je); // copy the entry header to jos
                        jos.write(outClazz);

So the program check if there is a class corresponding to a directory entry ... for example
m_classes = {com/truc/blabla.class} and curEntry = WEB-INF/classes/com/truc/blabla.class
So the orignal class is copied and not replaced.

  
> maven-ipojo-plugin & WAR
> ------------------------
>
>                 Key: FELIX-2825
>                 URL: https://issues.apache.org/jira/browse/FELIX-2825
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: iPOJO-1.8.0
>         Environment: Jetty, Windows
>            Reporter: Dyblast
>
> HI,
> I have notice a problem with the maven-ipojo-plugin on war package.
> The resulting classes are incorrect.
> Indeed when i create a war i have this error when i deploy it:
>  createInstance -> Cannot invoke the constructor (method not found) :
> Now if i create a bundle instead, i take the classes from it and i put it in the former war, the war works
> my plugins part of maven:
> -------------------------------------------------
>         <plugins>
>             <plugin>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <configuration>
>                     <archive>
>                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
>                     </archive>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-bundle-plugin</artifactId>
>                 <version>1.4.3</version>
>                 <extensions>true</extensions>
>                 <executions>
>                     <execution>
>                         <id>bundle-manifest</id>
>                         <phase>process-classes</phase>
>                         <goals>
>                             <goal>manifest</goal>
>                         </goals>
>                         <configuration>
>                             <instructions>
>                                 <Bundle-ClassPath>
>                                     .,
>                                     WEB-INF/classes
>                                 </Bundle-ClassPath>
>                                 <Embed-Directory>WEB-INF/lib</Embed-Directory>
>                                 <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>                                 <Embed-Transitive>true</Embed-Transitive>
>                                 <Web-ContextPath>webapp</Web-ContextPath>
>                                 <Webapp-Context>webapp</Webapp-Context>
>                             </instructions>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <supportedProjectTypes>
>                         <supportedProjectType>jar</supportedProjectType>
>                         <supportedProjectType>bundle</supportedProjectType>
>                         <supportedProjectType>war</supportedProjectType>
>                     </supportedProjectTypes>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-ipojo-plugin</artifactId>
>                 <version>1.8.0</version>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>ipojo-bundle</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
> -------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira