0 Replies Latest reply on Dec 8, 2005 2:14 PM by didi mann

    Uploaded File Problem

    didi mann Newbie

      I' m using the DVD example as template for a small application, which should download Files.

      I use the tomahawk extensions:

      ...
      <x:inputFileUpload id="myFileId"
       value="#{topic.mytmpfile}"
       storage="file"
       required="true"/>
       <h:message for="myFileId" styleClass="errors" />
       </div>
       <div class="entry">
       <div class="label"> </div>
       <div class="input">
       <h:commandButton action="#{topic.processMyFile}" value="Hochladen"/>
       </div>
       </div>
      ...
      


      The managed bean (extends the EntityBean Topic) has an attribut mytmpfile and a method to process the file(persist somewhere):


      public class TopicBean extends Topic implements Serializable{
       private UploadedFile mytmpfile;
      ...
      public String processMyFile() {
      
       if (mytmpfile != null && tmptopic!=null) {
       //here the exception occurs!
       MyFile tmp=new MyFile(mytmpfile);
       Topic tmpTopic= Utils.getTopicEdit().getTopicByName(tmptopic);
      //get the interface of the stateless session bean and addthe file
      Utils.getTopicEdit().addFile(tmp,tmpTopic);
       mytmpfile=null;
      
       return "uploaded";
       } else {
       System.out.println("Data incomplete...");
       return null;
       }
       }
      

      When this line(MyFile tmp=new MyFile(mytmpfile)) is executed the following Exception occurs:


      java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
      javax.faces.el.EvaluationException: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:75)
       at javax.faces.component.UICommand.broadcast(UICommand.java:364)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:430)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:739)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:241)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:109)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:181)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at org.jboss.projects.performance.web.TopicBean.processMyFile(TopicBean.java:117)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:51)
       ... 30 more
      20:12:35,659 INFO [STDOUT] 08.12.2005 20:12:35 com.sun.faces.lifecycle.InvokeApplicationPhase execute
      WARNUNG: #{topic.processMyFile}: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
      javax.faces.FacesException: #{topic.processMyFile}: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:87)
       at javax.faces.component.UICommand.broadcast(UICommand.java:364)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:430)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:739)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:241)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:109)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:181)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:75)
       ... 29 more
      Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at org.jboss.projects.performance.web.TopicBean.processMyFile(TopicBean.java:117)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:51)
       ... 30 more
      20:12:35,669 INFO [STDOUT] 08.12.2005 20:12:35 com.sun.faces.lifecycle.LifecycleImpl phase
      WARNUNG: executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@1cf437c) threw exception
      javax.faces.FacesException: #{topic.processMyFile}: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:85)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:241)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:109)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:181)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.FacesException: #{topic.processMyFile}: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:87)
       at javax.faces.component.UICommand.broadcast(UICommand.java:364)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:430)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:739)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
       ... 25 more
      Caused by: javax.faces.el.EvaluationException: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:75)
       ... 29 more
      Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at org.jboss.projects.performance.web.TopicBean.processMyFile(TopicBean.java:117)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:51)
       ... 30 more
      20:12:35,669 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: #{topic.processMyFile}: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:87)
       at javax.faces.component.UICommand.broadcast(UICommand.java:364)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:430)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:739)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:241)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:109)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:181)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:71)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:75)
       ... 29 more
      Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/myfaces/custom/fileupload/UploadedFile class
       at org.jboss.projects.performance.web.TopicBean.processMyFile(TopicBean.java:117)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:51)
       ... 30 more
      
      


      Any ideas?

      Cheers
      Dirk