CDI / Weld Unsatisfied dependencies problem [duplicate] - glassfish-4

This question already has answers here:
WELD-001408 Unsatisfied dependencies for type [Validator]
(2 answers)
Closed 8 years ago.
I have a strange CDI / Weld issue that I just can't figure out a solution for.
I've just installed GlassFish 4 with the intention of moving our main product over to it but when I try to deploy it I get the stack trace shown below in the log files (and it fails to deploy).
This is a mature application used in production on GlassFish 3.1.x in several locations so I know the code is good (at least on JEE6 anyway).
I really don't even know where to begin looking for this as the stack trace doesn't even go near any of my code. I've looked up the source for the ValidationInterceptor class and apparently the Validator mentioned in the error messages is of type javax.validation.Validator but that doesn't help as I have nothing that implements that interface in my code.
Thanks for any pointers regarding where to look / how to fix this.
WARNING: The following warnings have been detected: WARNING: Parameter 1 of type javax.enterprise.inject.spi.Bean<?> from public static void org.apache.myfaces.extensions.cdi.jsf.impl.util.WeldCache.setBean(javax.enterprise.inject.spi.Bean<?>) is not resolvable to a concrete type.
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Validator] with qualifiers [#Default] at injection point [[UnbackedAnnotatedField] #Inject private org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor.validator]
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Validator] with qualifiers [#Default] at injection point [[UnbackedAnnotatedField] #Inject private org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor.validator]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
at org.jboss.weld.bootstrap.Validator.validateInterceptor(Validator.java:554)
at org.jboss.weld.bootstrap.Validator.validateInterceptors(Validator.java:530)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
... 36 more

I had exactly the same problem than you.
I resolved this by removing Apache MyFaces CODI from my project since it seems to be incompatible with JEE7
If you are using Apache MyFaces CODI in your project this could be the cause of your problem
You can find additional info Here
Regards

Related

ClassCastException: MyFilter cannot be cast to javax.servlet.Filter

I'm migrating an application to JBoss 7, where all dependencies were in "JBOSS_HOME/server/default/lib" (JBoss 4). I included the lib "servlet.jar" (javax.servlet. *), however, after setting a Global Module for JBoss 7 (modules.xml, standalone.xml, jboss-deployment-structure.xml in war files), libraries are loaded normally by JBoss.
When JBoss 7 tries to start the filters, I get following exception:
15:09:15,222 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RegistrarValorDolar]] (MSC service thread 1-2) Exception starting filter cripto: java.lang.ClassCastException: cenpra.com.sigtec.business.utilities.SessionFilter cannot be cast to javax.servlet.Filter
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_15]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_15]
Trying to remove the library "servlet.jar" from Global Modules, in a try that the server loads it's own classes using an internal jar, I got a ClassNotFoundExceptionof javax.servlet.Filter class.
I want to use global modules, since I need to reuse a lot of libraries.
Your classpath is polluted with multiple different versioned javax.servlet.Filter classes. A class which is loaded by classloader X (e.g. the one responsible for container's internal classes) is not the same class when it's loaded by classloader Y (e.g. the one responsible for webapp's classes).
I included the lib "servlet.jar" (javax.servlet.)
This does at least not sound right. This is supposed to be already provided by the target servletcontainer (which is JBoss in your case). You should absolutely not provide servletcontainer-specific libraries along with the webapp in its /WEB-INF/lib folder. This would only end up in runtime classpath disaster because they get classloading precedence over the ones provided by the servletcontainer itself and thus conflicts with servletcontainer's internal classes which are in turn using servletcontainer's own classes.
Get rid of servletcontainer-specific libraries in /WEB-INF/lib folder.
This is a common starter's mistake in a careless attempt to fix/circumvent compilation errors on javax.servlet API which they face in their IDE. It should have been solved differently. To the point, you need to tell the IDE to associate the web project with the given target container. The IDE will then automatically do the necessary build path magic.
See also:
How do I import the javax.servlet API in my Eclipse project?

Eclipse + GWT + spring + maven: classnotfoundexception

I have a weird problem with my setup that I don't understand. I'm working on a maven GWT project that runs fine in a shell (i.e. mvn gwt:run is working as expected).
However, when I try to run it in Eclipse (with m2e and gwt plugin installed), I get a classnotfoundexception. The class is an entity class and the exception occurs when the entity manager is built. I checked that the class is declared in the persistence.xml and I cannot find any exclusion in the pom.xml or the eclipse build path.
On top of this, it works fine for someone else working on the exact same project.
My guess is that I have a configuration error in Eclipse but I didn't tweek anything.
Any ideas?
Eclipse 4.2
GWT 2.4
Maven 3.0.3
Spring 3.0.5
[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload#57790a{/,C:\Users\gere\Documents\netlight-workspace\NET2\target}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1386)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 30 more
Caused by: java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
... 38 more
[WARN] Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found:
java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
1) Try executing mvn clean install and then launching the hosted mode. If it works this means some classes/files need to be copied into target for your project to work.
2) If you trying to use Google GWT Webapp Launch, then check your launch folders for arguments. You should try and align it to maven's set up of target, artifact with/without version id etc
3) Check your project names to see if you have imported the maven project with versionid suffix to your project. This might be causing some classpath issues.
It could be the classloading of GWT-Eclipse. By default when running a GWT application from Eclipse all jars in the lib folder are added to the running applications classpath. In addition when Eclipse-GWT comes across any classes that are not on this classpath it searches the system classpath. If it finds the class the corresponding jar is also added to the running applications classpath. This will be logged in the console.
Generally this is okay but it does cause issues when you search the classpath. Classes won't be found unless the jar has been added to the running classpath by Eclipse. You can hack things but its not ideal (see the answer to this question).
I am guessing that with Maven all the Maven dependency jars are being added to the system classpath. When combined with Spring and JPA then there is a lot of classpath searching going on.
That doesn't explain why it works on another persons mechine - unless they have additional jars in their web app lib folder.
As to how to fix it "properly" I am not sure. I am in the same position myself - I have one application that works and one that is configured in a very similar way that doesn't. It's also the reason I found this question!

Exception java.lang.NoClassDefFoundError in Dynamic Web Application, Eclipse, JSF [duplicate]

This question already has answers here:
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
(2 answers)
Closed 7 years ago.
when I'm running my appication everything is ok to moment when I press the button and I'm redirecting to another xhtml page. Then eclipse console until I stop server display:
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/ChatAzure] threw exception [javax/servlet/jsp/jstl/core/Config] with root cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:345)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I use:
eclipse, jsf2-1-7, jstl-1.2.jar, Tomcat v0.7.
I don't know what's wrong, I need help.
The mentioned class is part of JSTL. This is normally already provided by a full fledged Java EE container, but not in Tomcat as being a barebones JSP/Servlet container. You'd need to supply JSTL yourself along with the web application. It has ultimately to be placed in the webapp's runtime classpath.
You correctly mentioned jstl-1.2.jar (I assume that it's exactly the one as you could find in our JSTL wiki page), but this problem indicates that it has apparently not been placed at the right place. You need to place it in /WEB-INF/lib folder of the web project. This folder is covered by webapp's default runtime classpath. Nothing more needs to be done. If you have ever fiddled in the project's Build Path properties in an attempt to solve it, you should undo all those attempts.
Unrelated to the concrete problem: why are you still using legacy JSP? It has been deprecated and succeeded by Facelets (XHTML) since JSF 2.0. Make sure that you're reading up to date JSF 2.x resources and not JSF 1.x ones while learning JSF.

Class cast exception when invoking a web service in Jboss 4.2.3 GA

We have created a web service in Netbeans 7.1 which is running fine on glassfish 3.1.1. Now I have to move my service application to Jboss 4.2.3 GA-JDK6. There is no problem found when deploying the web service on Jboss, but however invoking the web service causes an exception: -
"setProperty must be overridden by all subclasses of SOAPMessage class". To overcome this problem I had added jboss-native-saaj.jar in the JBOSS_HOME/lib/endorsed. which resolved the problem and the service got invoked but failed to return the response, but it resulted in a new exception: -
Caused by: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot be cast to org.jboss.ws.core.soap.SOAPElementImpl
at org.jboss.ws.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:60)
at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:124)
at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:96)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:280)
at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:84)
at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:518)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:307)
... 54 more
Also I want to tell that I'm actually invoking a webservice from within a webservice.
Please help in this, as there no documentation or solution available for the same.
Thanks in Advance
Adding the complete stacktrace of the previously occurred error:-
javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:404)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:314)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
at $Proxy183.authenticateUser(Unknown Source)
at com.liaison.soi.sts.usermgmt.service.impl.UserManagementServiceImpl.authenticateUser(UserManagementServiceImpl.java:46)
at com.liaison.soi.sts.usermgmt.service.impl.UserManagementServiceImpl.authenticateUser(UserManagementServiceImpl.java:25)
at com.liaison.soi.sts.auth.AuthenticationHandler.validate(AuthenticationHandler.java:24)
at com.sun.xml.wss.impl.callback.PasswordValidationCallback.getResult(PasswordValidationCallback.java:80)
at com.sun.xml.wss.impl.misc.DefaultSecurityEnvironmentImpl.authenticateUser(DefaultSecurityEnvironmentImpl.java:1166)
at com.sun.xml.ws.security.opt.impl.incoming.UsernameTokenHeader.validate(UsernameTokenHeader.java:160)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.handleSecurityHeader(SecurityRecipient.java:341)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.cacheHeaders(SecurityRecipient.java:275)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:225)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.verifyInboundMessage(SecurityTubeBase.java:450)
at com.sun.xml.wss.jaxws.impl.SecurityServerTube.processRequest(SecurityServerTube.java:295)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:213)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:454)
at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:83)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:171)
at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:59)
at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:158)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:291)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
I think your problem is in following.
The implementation SOAPMessageImpl was packaged in jboss-native-saaj.jar only till JBoss 3.2.2.GA (check here). Latest JBoss has this class in jbossws-native-core.jar. So you create a class conflict when you put jboss-native-saaj.jar into server/libs (or package with your application). So the solution will be: just remove jboss-native-saaj.jar, as jbossws-native-core.jar is (I believe) already there.
To make sure check META-INF for jboss-native-saaj.jar: was it packaged for JBoss 4.2.3? what is that date of packaging? This will take you to right decision.
This can be easily googled.
See https://issues.jboss.org/browse/JBWS-1439 and https://community.jboss.org/message/618306.
It's a well-known issue under Java 6 caused by obsolete jax-ws jars bundled within.
You'll have to play with moving some jars to endorsed dir as noted in above issue.
An alternative solution is to upgrade to JBossWS-3.1.1 (the last one supporting JBoss AS 4.2.3.GA).
Same issue in JBoss 5.1.2 is resolved with the addition of
jboss-as/lib/endorsed/jbossws-native-factories-3.1.2.SP11.jar

Problem running a GWT 2.4 App on Tomcat

I have a problem running my gwt2.4rc1 application in a tomcat. The problem occurs when I try to make a requestfactory call. Then I get the exception at the bottom.
When I run GWT in development mode everything works fine. The gwt-dev. jar is in the lib folder of my webapp. I am using maven for dependency management. Could there be a problem with my configuration? I already had the error with gwt2.4 beta. If there are any other information required to solve this problem I am glad to provide them.
Regards,
Arne
SEVERE: Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: Unexpected checked exception
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.die(ServiceLayerDecorator.java:216)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:242)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveRequestFactory(ServiceLayerCache.java:198)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:201)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:125)
at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:261)
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:175)
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:162)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/dev/util/StringKey
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2804)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1144)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1639)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateProxy(RequestFactoryInterfaceValidator.java:1594)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateEntityProxy(RequestFactoryInterfaceValidator.java:828)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.maybeCheckProxyType(RequestFactoryInterfaceValidator.java:1540)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.getDomainType(RequestFactoryInterfaceValidator.java:1374)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.createDomainMethod(RequestFactoryInterfaceValidator.java:1192)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.checkClientMethodInDomain(RequestFactoryInterfaceValidator.java:1079)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateRequestContext(RequestFactoryInterfaceValidator.java:909)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateRequestFactory(RequestFactoryInterfaceValidator.java:964)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestFactory(ResolverServiceLayer.java:187)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
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 com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233)
... 32 more
Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.util.StringKey
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1672)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
... 57 more
There's a fix for this on its way over from RC to trunk. In the mean time, remove gwt-servlet from your dependencies and use requestfactory-servlet.jar instead.
I've always understood gwt-dev.jar to be the compiler and other development tools. If you believe that, there should be no dependency on it from your own code, and there is no reason for it to be in the WEB-INF/lib folder of your war file.
I see from this question that at least one other contributer to SO feels the same way, but the belief doesn't appear to be universal.
I'll update this answer if I can find anything one way or the other in the GWT docs.
Update:
The closest thing I could find was Organize Projects which shows gwt-dev as a referenced library not present in WEB-INF/lib. I can't find anything official that says either that you can or can't deploy it to your web server. In an old book GWT In Action (Hanson, 2007), page 551 says
You should never deploy the gwt-user.jar and gwt-dev.jar files to your server,
because they will interfere with your server; these JAR files contain their own
Tomcat server code, which is used when you're testing in hosted mode.
This is clearly out of date, since hosted mode isn't called that anymore and uses an embedded Jetty server rather than Tomcat, but that's the basis for my belief.
Ok I made it working :)
I used the gwt version compiled from here:
http://code.google.com/p/google-web-toolkit/source/browse/#svn%2Freleases%2F2.4
I did put gwt-servlet.jar and requestfactory-servlet.jar as dependencies in my project. The problem in the other thread occured because I used my own group-id for the compiled jars, so these were not used by gin and the gwt-maven-plugin. No everything works fine :)
Thanks for the help though!!