Question

After starting glassfish server i get this warnings:

Warning:   Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
Warning:   Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled

What can be the reason of this warnings ? How can i get rid of them ?


UPD1.

It appears that NetBeans is putting a bunch of jersey jars into the WEB-INF/lib directory of the application when it is built. These jars should not be placed in WEB-INF/lib

So it might be, because some jars not should be placed in WEB-INF/lib Here what i have:

libs in WEB-INF


UPD2.

If you use Netbeans 7.4 and use the "new Java web application" wizard and just click through the defaults except be sure to check the box to include "contexts and dependency injection", then run it on GlassFish 4 and you'll get the warning.

:(


UPD3. Someone saying here that The following warning messages should be ignored, they are 'false-positive' alert messages


UPD4. Yes, i am using maven. Here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>WebSite</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>WebSite</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>      
        <repository>  
            <id>prime-repo</id>  
            <name>PrimeFaces Maven Repository</name>  
            <url>http://repository.primefaces.org</url>  
            <layout>default</layout>  
        </repository>
    </repositories>

    <dependencies>    

        <dependency>  
            <groupId>com.octo.captcha</groupId>  
            <artifactId>simplecaptcha</artifactId>  
            <version>1.2.1</version>
            <type>jar</type>
        </dependency>     

        <dependency>  
            <groupId>org.primefaces</groupId>  
            <artifactId>primefaces</artifactId>  
            <version>4.0</version>  
        </dependency>  

        <dependency>  
            <groupId>org.primefaces.themes</groupId>  
            <artifactId>all-themes</artifactId>  
            <version>1.0.10</version>  
        </dependency> 

        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>1.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>resources-codemirror</artifactId>
            <version>1.2.1</version>
        </dependency>  

          <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>resources-ckeditor</artifactId>
            <version>1.2.1</version>
        </dependency>   

        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-runtime</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.imgscalr</groupId>
            <artifactId>imgscalr-lib</artifactId>
            <version>4.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.5</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.30</version>
            <scope>provided</scope>
        </dependency>


        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.5.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.3</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.ganyo</groupId>
            <artifactId>gcm-server</artifactId>
            <version>1.0.2</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
        </plugins> 
    </build>

</project>
Était-ce utile?

La solution

The reason: Classes javax.ejb.PostActivate and javax.ejb.PrePassivate were not found. You are missing a dependency.

Add this dependency to your pom.xml:

<dependency>
    <groupId>javax.ejb</groupId>
    <artifactId>javax.ejb-api</artifactId>
    <version>3.2</version>
</dependency>

Regards, A.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top