Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-12

org.apache.openejb.config.AnnotationDeployer throws InstantiationException on com.sun.jersey.api.core.ApplicationAdapter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Fedora 14 x86_64, OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode), apache-tomee-4.0.0-20110817.224012-14, jersey 1.7 APIs

      Description

      The "public WebModule deploy(WebModule webModule)" throws an InstantiationException when attempting to get a newInstance() of a com.sun.jersey.api.core.ApplicationAdapter. Looking at the jersey source, the ApplicationAdapter does not have a null constructor, only a constructor that accepts an javax.ws.rs.core.Application argument.

      This problem does not occur with OpenEJB 3.1.4.

      Test code to replicate the results:

      public static void main(String[] args) throws Exception {
      String className = "com.sun.jersey.api.core.ApplicationAdapter";
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      Class<?> clazz = classLoader.loadClass(className);
      Application app = null;
      try

      { app = Application.class.cast(clazz.newInstance()); }

      catch (InstantiationException ie)

      { ie.printStackTrace(); Constructor<?> cstor = clazz.getDeclaredConstructors()[0]; app = Application.class.cast(cstor.newInstance(new Application())); System.out.println(app.getClass().getName()); }

      }

      Stack Dump from $CATALINA_HOME/logs/openejb.log:

      org.apache.openejb.OpenEJBException: Unable to instantiate Application class: com.sun.jersey.api.core.ApplicationAdapter: com.sun.jersey.api.core.ApplicationAdapter
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1618)
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1418)
      at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:275)
      at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:235)
      at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:661)
      at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:537)
      at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:346)
      at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:321)
      at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:300)
      at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:130)
      at org.apache.openejb.OpenEJB.init(OpenEJB.java:276)
      at org.apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.java:203)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.openejb.loader.Embedder.init(Embedder.java:75)
      at org.apache.openejb.tomcat.loader.TomcatHook.hook(TomcatHook.java:163)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.openejb.tomcat.loader.TomcatEmbedder.embed(TomcatEmbedder.java:100)
      at org.apache.openejb.tomcat.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java:68)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
      at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379)
      at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
      at org.apache.catalina.startup.Catalina.load(Catalina.java:572)
      at org.apache.catalina.startup.Catalina.load(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
      Caused by: java.lang.InstantiationException: com.sun.jersey.api.core.ApplicationAdapter
      at java.lang.Class.newInstance0(Class.java:357)
      at java.lang.Class.newInstance(Class.java:325)
      at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1615)

        Attachments

          Activity

            People

            • Assignee:
              romain.manni-bucau Romain Manni-Bucau
              Reporter:
              alan.stroop Alan Stroop
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: