java.lang.ClassCastException: org.jboss.as.connector.subsystems.datasources.WildFlyDataSource cannot be cast to javax.naming.Context 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at com.cdi.crud.infra.rest.RestApplication.initialize(RestApplication.java:117) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at java.lang.reflect.Method.invoke(Method.java:497) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:98) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.resteasy.cdi.JaxrsInjectionTarget.postConstruct(JaxrsInjectionTarget.java:77) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:171) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)

Stack Overflow | Ratha | 10 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    WildFlyDataSource cannot be cast to javax.naming.Context

    Stack Overflow | 10 months ago | Ratha
    java.lang.ClassCastException: org.jboss.as.connector.subsystems.datasources.WildFlyDataSource cannot be cast to javax.naming.Context 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at com.cdi.crud.infra.rest.RestApplication.initialize(RestApplication.java:117) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at java.lang.reflect.Method.invoke(Method.java:497) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:98) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.resteasy.cdi.JaxrsInjectionTarget.postConstruct(JaxrsInjectionTarget.java:77) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:171) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.jboss.as.connector.subsystems.datasources.WildFlyDataSource cannot be cast to javax.naming.Context 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at com.cdi.crud.infra.rest.RestApplication.initialize(RestApplication.java:117) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:44:05,140 ERROR [stderr] (ServerService Thread Pool -- 68) at java.lang.reflect.Method.invoke(Method.java:497) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:98) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.resteasy.cdi.JaxrsInjectionTarget.postConstruct(JaxrsInjectionTarget.java:77) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:171) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) 16:44:05,141 ERROR [stderr] (ServerService Thread Pool -- 68) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)

      at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get()
    2. Weld Implementation
      ProxyMethodHandler.getInstance
      1. org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
      2. org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      3. org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
      4. org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
      4 frames
    3. com.cdi.crud
      RestApplication$Proxy$_$$_WeldClientProxy.getClasses
      1. com.cdi.crud.infra.rest.RestApplication$Proxy$_$$_WeldClientProxy.getClasses(Unknown Source)
      1 frame
    4. RESTEasy JAX-RS Implementation
      HttpServletDispatcher.init
      1. org.jboss.resteasy.spi.ResteasyDeployment.processApplication(ResteasyDeployment.java:485)
      2. org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:331)
      3. org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:245)
      4. org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
      5. org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
      5 frames