You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (Commented) (JIRA)" <ji...@apache.org> on 2011/10/09 17:43:29 UTC

[jira] [Commented] (TOMEE-12) org.apache.openejb.config.AnnotationDeployer throws InstantiationException on com.sun.jersey.api.core.ApplicationAdapter

    [ https://issues.apache.org/jira/browse/TOMEE-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123711#comment-13123711 ] 

Romain Manni-Bucau commented on TOMEE-12:
-----------------------------------------

in openejb > 3.x (or tomee 1.x) rest services are deployed following this rule:

1) all rest services are scanned
2) if an Application implementation is found it is used otherwise all found services are deployed

i'll fix the deployement to ignore not instantiable application children but rest services will still be deployed.

IMHO you shouldn't deploy jersey in tomee 1.0.0

can you try without it?
                
> org.apache.openejb.config.AnnotationDeployer throws InstantiationException on com.sun.jersey.api.core.ApplicationAdapter
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMEE-12
>                 URL: https://issues.apache.org/jira/browse/TOMEE-12
>             Project: TomEE
>          Issue Type: Bug
>         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
>            Reporter: Alan Stroop
>            Assignee: Romain Manni-Bucau
>            Priority: Minor
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira