1
votes

I have a demo enterprise application (ear) defined in Netbeans 7.4 with one Java EE module (war).

When i deploy the war to the Weblogic server, deployment is successful and the ServletContextListener is executed.

The same war file contains a class which extends ApplicationLifecycleListener. This class is defined as a listener in the weblogic-application.xml

<listener>
  <listener-class>com.reddipped.sysstats.jmx.mbean.SysStatsMBeanLifeCycleListener</listener-class>
</listener>

On deployment of the ear i get the following exception;

Deploying /home/developer/NetBeansProjects/SysStats/dist/wldeploy/SysStats Deployment failed. The message was: java.lang.ClassNotFoundException: com.reddipped.sysstats.jmx.mbean.SysStatsMBeanLifeCycleListener /home/developer/NetBeansProjects/SysStats/nbproject/build-impl.xml:301: The module has not been deployed.

The war is included in the ear... what am i missing here? Package and classname are correct in the listener-class, even copied and pasted the names from the war file..

Cheers Peter

[update 09/19/2014]

Now split up the project in an enterprise application, web application and one jar file. On deployment now het a weblogic.management.DeploymentException: classloader-structure element in weblogic-application.xml is referencing the module-uri SysStatsMBean.jar which does not exist in this application

When build the ear file now has the following structure.

SysStats.ear
  - SysStats-war.war
      - META-INF
      - WEB-INF
        - classes
          - com
            - reddipped
              - sysstats
                - model
                  - SystemInfo.class
                  - SystemInfoCollector.class
                  - SystemInfoCollectorExecutor.class
  - SysStatsMBean.jar
          - com
            - reddipped
              - sysstats
                - model
                  - SysStats.class
                  - SysStatsMBeanLifeCycleListener.class
                  - SysStatsMXBean.class
  - META-INF
    application.xml
    MANIFEST.MF
    weblogic-application.xml

Weblogic-application.xml contains

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://xmlns.oracle.com/weblogic/weblogic-application"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd     http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-    application/1.0/weblogic-application.xsd">
      <listener>
        <listener-    class>com.reddipped.sysstats.jmx.mbean.SysStatsMBeanLifeCycleListener</listener-class>
    </listener>

<classloader-structure>
    <module-ref>
        <module-uri>SysStats-war.war</module-uri>
    </module-ref>

    <module-ref>
        <module-uri>SysStatsMBean.jar</module-uri>
    </module-ref>

</classloader-structure>

</weblogic-application>    
1

1 Answers

1
votes

Were able to resolve this issue by adding the listener-uri. Although the class is available in the default package it must be explicitly added to the listener element.

  <listener>
    <listener-class>com.reddipped.sysstats.jmx.mbean.SysStatsMBeanLifeCycleListener</listener-class>
    <listener-uri>SysStatsMBean.jar</listener-uri>
</listener>