[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 559
  • Last Modified:

Error on add Jasper Report

When i add jasperreport dependency in my pom i get the following error::

Informações: Starting Servlet Engine: Apache Tomcat/7.0.12
java.lang.IllegalAccessError: class org.xml.sax.helpers.SecuritySupport12 cannot access its superclass org.xml.sax.helpers.SecuritySupport
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
      at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1956)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1919)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1806)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1765)
      at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1751)
      at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1255)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:882)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5081)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
      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:606)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

Searching on internet i find:


The servlet 2.3 spec says (9.6.2 Web Application Classloader):
"The classloader that a container uses to load a servlet in a WAR must not
allow the WAR to override JDK or Java Servlet API classes, and is recommended not to allow Servlets in the WAR visibility of the web containers implementation classes. If a web container has a mechanism for exposing container-wide library JARs to application classloaders, it is recommended that the application classloader be implemented in such a
way that classes packaged within the WAR are able to override classes
residing in containerwide
library JARs."





I've tryed :

http://stackoverflow.com/questions/8470450/why-does-java-to-throw-illegalaccesserror-when-invoking-mxmlc
http://atoksyahcodezz.blogspot.com.br/2013/07/error-java.html 
neste site diz para fazer o que está abaixo:
Tomact 7 Errors
If you receive blow error if you try to deploy your application under Tomcat 7.

java.lang.IllegalAccessError: class javax.activation.SecuritySupport12 cannot access its superclass javax.activation.SecuritySupport

please add metadata-complete="true" in your web.xml to override default properties of 3.0 for annotations.




The metadata-complete attribute of the web-app element in a Web application's deployment descriptor specifies whether the Web descriptor and other related deployment descriptors for this module (such as Web service descriptors) are complete
If servlet version is set to 2.4 or an earlier version, the servlet container does not process any annotations.

If the metadata-complete attribute is missing or is set to false, the default value for Servlet 2.5/3.0, and version is set to 2.5/3.0, the servlet container examines the class files of the application for servlet annotations and supports the annotations


After to put metadata=true i1ve got the error:


Jan 04, 2014 8:59:32 PM org.apache.catalina.core.StandardContext listenerStart
Grave: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [FacesContext] with qualifiers [@Default] at injection point [[field] @Inject private br.com.confiabilidade.controller.RelatorioItemsDosTecnicosBean.facesContext]
      at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
      at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
      at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
      at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
      at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
      at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
      at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
      at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:182)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
      at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)

t ve tryed too::

http://osdir.com/ml/JavaServerFaces/2013-07/msg00207.html
Bom... essa parte de dependências de parser XML depende de outras coisas além do jasper. Teste com

            <dependency>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
                <version>1.4.01</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
                <version>2.10.0</version>
                <scope>test</scope>
            </dependency>

dependendo das fontes vc pode precisar tbm:

            <dependency>
                <groupId>net.sf.jasperreports</groupId>
                <artifactId>jasperreports-fonts</artifactId>
                <version>4.0.0</version>
            </dependency>
0
Rafael_Moreira
Asked:
Rafael_Moreira
1 Solution
 
girionisCommented:
WELD-001408 Unsatisfied dependencies for type [FacesContext] with qualifiers [@Default] at injection point [[field] @Inject private

The error simply means that the CDI engine does not know how to initialise a FacesContext object, so my guess is that you're trying to inject a FacesContext. If my guess is correct then you simply cannot do it. The FacesContext is not injectable. Therefore I suggest two solutions:

1) Do not inject FacesContext, obtain it by doing FacesContext.getCurrentInstance().
2) Define a producer method as explained here.

import javax.enterprise.inject.Produces;


class FacesContextProducer {

   @Produces @RequestScoped FacesContext getFacesContext() {

      return FacesContext.getCurrentInstance();

   }

}

Open in new window

0
 
Rafael_MoreiraAuthor Commented:
this solve my problem.
thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now