1 Reply Latest reply on May 29, 2009 4:29 AM by jaikiran pai

    deployment for Spring web app fails

    Michael Phoenix Newbie

      When I try to deploy my web app, the deployment fails.. The following appears to be the main cause of the failure. Does anybody have any idea what the problem may be? It looks like it might have something to do with Namimg/JNDI. I have also included the code that uses JNDI for rmi calls to EJBs below the error messages.

      17:39:11,084 ERROR [[/BurnsideWeb]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
      java.lang.IncompatibleClassChangeError: Class org.jnp.server.NamingServer does not implement the requested interface org.jnp.interfaces.Naming
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at com.sun.faces.config.WebConfiguration.processJndiEntries(WebConfiguration.java:532)
      at com.sun.faces.config.WebConfiguration.(WebConfiguration.java:105)
      at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:158)
      at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:144)
      at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:71)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
      at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
      at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
      at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
      at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      at org.jboss.web.WebModule.startModule(WebModule.java:83)


      /*
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
      
      package com.lingosys.burnside.api;
      
      import java.util.*;
      
      import org.apache.log4j.*;
      
      import com.attask.api.*;
      import com.attask.beans.api.*;
      
      /**
       * Reformats AtTask project name
       * @author mphoenix
       */
      public class NameConverter {
       // Constants
       private static final Logger LOG = LogManager.getLogger(NameConverter.class);
      
       // Fields
       /** AtTask uses its own session IDs */
       protected static String _sessionID = null;
      
       /** Provides access to the information AtTask stores in its sessions */
       protected static SessionAttributesBean _sessionAttributes;
      
       /** Implements the EJB calls */
       protected static API _api;
      
       /** AtTask uses a special int value to represent "null" */
       protected static int _intNull;
      
       public String go(String id) {
      
       try {
       // Connect to server.
       Properties props = System.getProperties();
       props.setProperty("java.naming.provider.url", "jnp://192.168.1.206:1099");
       props.setProperty("java.naming.provider.port", "8080");
       props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client");
       props.setProperty("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
       props.setProperty("jnp.timeout", "0");
       props.setProperty("jnp.sotimeout", "0");
       System.setProperties(props);
       APISupport.init(props);
       _api = APISupport.getAPI();
      
       // Login.
       String username = props.getProperty("test.username", "admin");
       String password = props.getProperty("test.password", "triSfm0tp");
       LOG.info("Logging in to web service");
       _sessionID = _api.login(username, password);
       _sessionAttributes = _api.getSessionAttributes(_sessionID);
       _intNull = _sessionAttributes.getIntNull();
      
       int projectID = new Integer(id).intValue();
       ProjectBean pb = _api.getProjectByProjectID(_sessionID, projectID);
       String projectName = pb.getName();
       pb.setName(id + " " + projectName);
       _api.editProject(_sessionID, pb);
      
       }
       catch (AtTaskAPIException atae) {
       LOG.error(atae.getMsg());
       LOG.error(atae.getCallStack());
       return "failure";
       }
       catch (Exception x) {
       LOG.error(x.getMessage());
       x.printStackTrace();
       return "failure";
       }
       finally {
       if (_sessionID != null) {
       try {
       LOG.info("Cleaning up");
      
       // Logout
       _api.logout(_sessionID);
       }
       catch (Exception x) {
       x.printStackTrace();
       return "failure";
       }
       }
       }
      
       LOG.info("Finished");
      
       return "success";
       }
      
      
      }
      
      


      
      /*
       * Copyright (c) 2007 AtTask, Inc.
       *
       * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
       * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
       * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
       * permit persons to whom the Software is furnished to do so, subject to the following conditions:
       *
       * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
       * Software.
       *
       * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
       * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
       * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
       * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
       */
      package com.lingosys.attask;
      
      import com.attask.api.*;
      
      import com.attask.beans.api.NameValueBean;
      
      import javax.ejb.CreateException;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.rmi.PortableRemoteObject;
      import java.rmi.RemoteException;
      import java.util.*;
      
      /**
       * Helper class to get API objects from the @task server
       * THIS CODE SHOULD NOT BE ALTERED
       */
      public class APISupport {
      
       private static InitialContext __iniCtx;
       private static API __api;
      
       /**
       * Default init method that will use properties files such as jndi.properties found in the CLASSPATH
       **/
       public static void init() {
       Properties props = System.getProperties();
       init(props);
       }
      
       /**
       * init method sets default system properties accepts hostname as argument
       * @param hostname String name of host AtTask is located on
       **/
       public static void init(String hostname) {
       Properties props = System.getProperties();
       props.setProperty("java.naming.provider.url", hostname + ":1099");
      // props.setProperty("java.naming.provider.port", "8080");
       props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client");
       props.setProperty("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
       props.setProperty("jnp.timeout", "0");
       props.setProperty("jnp.sotimeout", "0");
       init(props);
       }
      
       /**
       * init method to use if jndi.properties files would be in conflict with the Java client CLASSPATH
       * @param props Properties - system properties
       **/
       public static void init(Properties props) {
       try {
       __iniCtx = new InitialContext(props);
      
       } catch (NamingException nme) {
       nme.printStackTrace();
       }
       }
      
       //////////////////////////////////////////////////
       // Interfaces
       public static API getAPI(){
       try{
       // API. Because this is a Stateless Session Bean, we can cache the instance we are using
       if( __api != null ) return __api;
       Object obj = __iniCtx.lookup(APIHome.JNDI_NAME);
       APIHome apiHome = (APIHome) PortableRemoteObject.narrow(obj, APIHome.class);
       __api = apiHome.create();
       return __api;
       } catch (NamingException nme){
       nme.printStackTrace();
       } catch (CreateException ce){
       ce.printStackTrace();
       } catch (RemoteException re){
       re.printStackTrace();
       } catch (Throwable t){
       t.printStackTrace();
       }
      
       return null;
       }
      
       /**
       * Gets the {@link com.attask.api.PagedListAPI} class.
       */
       public static PagedListAPI getPagedListAPI(){
       try{
       // PagedList API cannot be cached as a Stateful Session Bean retains state per instance
       Object obj = __iniCtx.lookup(PagedListAPIHome.JNDI_NAME);
       PagedListAPIHome apiHome = (PagedListAPIHome) PortableRemoteObject.narrow(obj, PagedListAPIHome.class);
       return (PagedListAPI) apiHome.create();
       } catch (NamingException nme){
       nme.printStackTrace();
       } catch (CreateException ce){
       ce.printStackTrace();
       } catch (RemoteException re){
       re.printStackTrace();
       } catch (Throwable t){
       t.printStackTrace();
       }
      
       return null;
       }
      
       public static FlashAPI getFlashAPI() {
       try {
       Object obj = __iniCtx.lookup(FlashAPIHome.JNDI_NAME);
       FlashAPIHome apiHome = (FlashAPIHome) PortableRemoteObject.narrow(obj, FlashAPIHome.class);
       return apiHome.create();
       } catch (Throwable t) {
       t.printStackTrace();
       }
       return null;
       }
      
      
       /**
       * Convenient utility class for converting a Map to a NameValuePair[] used for searching
       *
       * @param map Map with String->Object or String->String[] mapping
       * @return array of {@see com.attask.beans.api.NameValueBean} objects
       */
       public static NameValueBean[] convertToNameValueBeans(Map map) {
       if (map == null || map.size() == 0) return new NameValueBean[]{};
      
       // Because the Map can have either String or String[], we need to use a List to get the all before conversion
       List list = new ArrayList();
       for (Iterator it = map.keySet().iterator(); it.hasNext();) {
       String name = (String) it.next();
       Object o = map.get(name);
       if (o == null) continue;
       if (o instanceof String[]) {
       String[] array = (String[]) o;
       for (int i = 0; i < array.length; i++) {
       list.add(getNameValueBean(name, array));
       }
       } else {
       list.add(getNameValueBean(name, o.toString()));
       }
       }
      
       // convert List back to NameValueBean[]
       NameValueBean[] ret = new NameValueBean[list.size()];
       for (int i = 0; i < list.size(); i++) {
       ret = (NameValueBean) list.get(i);
       }
      
       return ret;
       }
      
       protected static NameValueBean getNameValueBean(String name, String value) {
       NameValueBean nvb = new NameValueBean();
       nvb.setName(name);
       nvb.setValue(value);
       return nvb;
       }
      
      }