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)

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by Ratha
, 1 year ago
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
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(ContextualInstanceStrategy.java:141)
at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
at com.cdi.crud.infra.rest.RestApplication$Proxy$_$$_WeldClientProxy.getClasses(Unknown Source)
at org.jboss.resteasy.spi.ResteasyDeployment.processApplication(ResteasyDeployment.java:485)
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:331)
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:245)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Know the solutions? Share your knowledge to help other developers to debug faster.