geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell E Glaue <rgl...@cait.org>
Subject Re: Extending DeltaManager in GBean - NoClassDefFoundError: javax/servlet/http/HttpSession
Date Fri, 21 Jul 2006 20:22:45 GMT
Okay, I figured out the issue.
In Geronimo 1.0, I did not get this error when deploying.
But in order to implement another class in a gbean for Geronimo 1.1, the gbean 
deployment plan must also include the dependencies of the class it is implementing.

I added these dependencies into the plan, and now my gbean deploys:
-
       <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-j2ee_1.4_spec</artifactId>
         <version>1.1</version>
         <type>jar</type>
       </dependency>
       <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-servlet_2.4_spec</artifactId>
         <version>1.0.1</version>
         <type>jar</type>
       </dependency>
-

However, I get a startup error after deploying due to a configuration error.
I will send a separate e-mail for this issue.
-RG


Aaron Mulder wrote:
> So the only dependencies your plan is declaring are on catalina,
> catalina-cluster, and wnode JARs?  I don't see anything on that list
> indicating that the Servlet API should be included on the class path.
> 
> I think you have two choices -- one is to add the servlet API JAR as a
> dependency, and the other is to add a dependency on a module such as
> geronimo/tomcat/*/car which would already have the servlet API on its
> class path.
> 
> Thanks,
>    Aaron
> 
> On 7/21/06, Russell E Glaue <rglaue@cait.org> wrote:
>> Okay.
>> Thanks to Jason, I got the hostinfoGBean deployed successfully.
>>
>> now the next error...
>> I also want to report in the hostinfoGBean how many sessions are on a 
>> node in
>> the cluster.
>> So I edited my hostinfoGBean class to extend DeltaManager and then 
>> added a
>> function getSessionCount.
>>
>> It compiles successfully.
>> And it deploys in Geronimo 1.1, although with an error on deployment:
>>
>> deploy.sh deploy target/wnode-1.0.jar wnode-plan.xml
>> -
>> Exception in thread "Thread-4" java.lang.NoClassDefFoundError:
>> javax/servlet/http/HttpSession
>>          at java.lang.ClassLoader.defineClass1(Native Method)
>>          at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>          at 
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>          at
>> org.apache.geronimo.kernel.classloader.JarFileClassLoader.access$200(JarFileClassLoader.java:51)

>>
>>          at
>> org.apache.geronimo.kernel.classloader.JarFileClassLoader$6.run(JarFileClassLoader.java:275)

>>
>>          at java.security.AccessController.doPrivileged(Native Method)
>> ... snip ...
>>          at 
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
>>          at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) 
>>
>>          at java.lang.Thread.run(Thread.java:595)
>> -
>>
>> When deploying a similar GBean that extends DeltaManager in Geronimo 
>> 1.0, I did
>> not get this error.
>> Do I have to add another dependency in the deployment plan? I could 
>> not find the
>> artifact in the geronimo 1.1 repository that contains the javax 
>> HttpSession
>> class (Did I not look hard enough?). Do I have to deploy a new 
>> artifact to
>> Geronimo 1.1?
>>
>> Here is my updated code, the deployment plan has not changed.
>>
>> java file: org/cait/wnode/hostinfoGBean.java
>> -
>> package org.cait.wnode;
>>
>> import java.util.HashMap;
>> import org.apache.commons.logging.*;
>>
>> import org.apache.catalina.cluster.session.DeltaManager;
>> import org.apache.geronimo.gbean.GBeanInfo;
>> import org.apache.geronimo.gbean.GBeanInfoBuilder;
>> import org.apache.geronimo.gbean.GBeanLifecycle;
>>
>> public class hostinfoGBean extends DeltaManager implements 
>> GBeanLifecycle {
>>
>>          public static final GBeanInfo GBEAN_INFO;
>>
>>          private static final Log glog = 
>> LogFactory.getLog(hostinfoGBean.class);
>>
>>          public static GBeanInfo getGBeanInfo(){
>>                  return GBEAN_INFO;
>>          }
>>          static{
>>                  GBeanInfoBuilder infoBuilder = new
>> GBeanInfoBuilder("hostinfoGBean",hostinfoGBean.class);
>>                  infoBuilder.addInterface(hostinfoGBean.class);
>>                  GBEAN_INFO = infoBuilder.getBeanInfo();
>>          }
>>
>>          public void doFail() {
>>                  glog.info("Service failed");
>>                  // TODO Auto-generated method stub
>>          }
>>
>>          public void doStart() throws Exception {
>>                  glog.info("Service started");
>>                  // TODO Auto-generated method stub
>>          }
>>
>>          public void doStop() throws Exception {
>>                  glog.info("Service stopped");
>>                  // TODO Auto-generated method stub
>>          }
>>
>>          public String getName() {
>>                  return "node1.domain-noc1.test.com";
>>          }
>>          public String getPort() {
>>                  return "80";
>>          }
>>          public int getSessionCount() {
>>                  HashMap SessionHashMap = this.sessions;
>>                  int NumberOfSessions = 0;
>>                  NumberOfSessions = SessionHashMap.size();
>>                  return NumberOfSessions;
>>          }
>>
>> }
>> -
>>
>> deployment plan: wnode-plan.xml
>> -
>> <?xml version="1.0" encoding="UTF-8"?>
>> <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>    <environment>
>>      <moduleId>
>>        <groupId>wnode</groupId>
>>        <artifactId>wnode</artifactId>
>>        <version>1.0</version>
>>        <type>jar</type>
>>      </moduleId>
>>      <dependencies>
>>        <dependency>
>>          <groupId>tomcat</groupId>
>>          <artifactId>catalina-cluster</artifactId>
>>          <version>5.5.15</version>
>>          <type>jar</type>
>>        </dependency>
>>        <dependency>
>>          <groupId>tomcat</groupId>
>>          <artifactId>catalina</artifactId>
>>          <version>5.5.15</version>
>>          <type>jar</type>
>>        </dependency>
>>      </dependencies>
>>    </environment>
>>    <gbean name='hostinfoGBean' 
>> class='org.cait.wnode.hostinfoGBean'></gbean>
>> </module>
>> -
>>
>>
>>


Mime
View raw message