java.lang.StackOverflowError-文件上传错误

时间:2015-03-18 12:15:26

标签: java primefaces stack-overflow

我在使用primefaces时遇到问题,我为crud操作创建了一个UI,我将pdf文件作为“media”实体的内容字段上传,我添加了法语版本然后相同的UI是渲染添加英文版,当保存第一个“媒体”它顺利,问题是当我添加英文版,这里是堆栈跟踪

    javax.servlet.ServletException
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
      org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:102)
    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

cause mère

java.lang.StackOverflowError
    com.mysql.jdbc.Util.handleNewInstance(Util.java:433)
    com.mysql.jdbc.PreparedStatement.getInstance(PreparedStatement.java:874)
    com.mysql.jdbc.ConnectionImpl.clientPrepareStatement(ConnectionImpl.java:1478)
    com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4204)
    com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4103)
    com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:213)
    org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
    org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700) 
好吧,堆栈跟踪还没有完整,但我想这足以让我知道出了什么问题。 这是我正在上传pdf文件的sode snipet:String name = new String();

try{
        System.out.println("Dans l'action fileUpload");
        String path = FacesContext.getCurrentInstance().getExternalContext()
                .getRealPath("/");
        System.out.println("------------------"+path);
        path+="upload/media/";
        System.out.println("------------------"+path);
        SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss");
        name = fmt.format(new Date())
                +  contentLink.getFileName().substring(contentLink.getFileName().lastIndexOf('.'));

        File file = new File(path + name);

        media.setContenu(name);
        InputStream is = contentLink.getInputstream();
        OutputStream out = new FileOutputStream(file);
        byte buf[] = new byte[1024];
        int len;
        while ((len = is.read(buf)) > 0)
            out.write(buf, 0, len);
        is.close();
        out.close();
        System.out.println("upload termine");

感谢您的帮助,

0 个答案:

没有答案