qq_37586270
提刀来见
2019-06-10 15:26

com.jacob包 在Windows10开发环境运行正常,在Windows server 2008 抛出异常

  • 开发语言

com.jacob.com.ComFailException: Invoke of: AudioOutputStream
Source:
Description:

at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:625)
at com.jacob.com.Dispatch.invoke(Dispatch.java:498)
at com.jacob.com.Dispatch.putRef(Dispatch.java:819)
at net.bjnblh.dc.textToSpeech.service.MSTTSSpeech.saveToWav(MSTTSSpeech.java:274)
at net.bjnblh.dc.textToSpeech.service.impl.NoteReadingServiceImpl.makeWavAndReturnUrl(NoteReadingServiceImpl.java:70)
at net.bjnblh.dc.textToSpeech.service.impl.NoteReadingServiceImpl.docToHtml(NoteReadingServiceImpl.java:53)
at net.bjnblh.dc.textToSpeech.service.impl.NoteReadingServiceImpl$$FastClassBySpringCGLIB$$9c509776.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at net.bjnblh.dc.textToSpeech.service.impl.NoteReadingServiceImpl$$EnhancerBySpringCGLIB$$62d6289f.docToHtml(<generated>)
at net.bjnblh.dc.textToSpeech.controller.noteReadingController.getHtmlByWord(noteReadingController.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
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:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at net.bjnblh.dc.core.filter.CrossFilter.doFilter(CrossFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
    public void saveToWav(String text, String filePath)
    {
        // 创建输出文件流对象
        ax=new ActiveXComponent("Sapi.SpFileStream");
        spFileStream=ax.getObject();
        // 创建音频流格式对象
        if(spAudioFormat==null)
        {
            ax=new ActiveXComponent("Sapi.SpAudioFormat");
            spAudioFormat=ax.getObject();
        }
        // 设置音频流格式类型
        Dispatch.put(spAudioFormat,"Type",new Variant(this.formatType));
        // 设置文件输出流的格式
        Dispatch.putRef(spFileStream,"Format",spAudioFormat);
        // 调用输出文件流对象的打开方法,创建一个.wav文件
        Dispatch.call(spFileStream,"Open",new Variant(filePath),new Variant(3),new Variant(true));
        // 设置声音对象的音频输出流为输出文件流对象
        Dispatch.putRef(spVoice,"AudioOutputStream",spFileStream);
        // 调整音量和读的速度
        Dispatch.put(spVoice,"Volume",new Variant(this.volume));// 设置音量
        Dispatch.put(spVoice,"Rate",new Variant(this.rate));// 设置速率
        // 开始朗读
        Dispatch.call(spVoice,"Speak",new Variant(text));
    /*  分一句话去读
        Long initTime =System.currentTimeMillis();
        for (Element element:elements) {
            String text =element.childNode(0).toString();
            String[] strings= text.split("\\p{P}");
            String newNodeHtml ="";
            for (int n=0 ; n<strings.length;n++) {
                String start=String.valueOf(System.currentTimeMillis() - initTime);
                System.out.println(start);
                Dispatch.call(spVoice,"Speak",new Variant(strings[n]));
                newNodeHtml += "<span id=" +start+ ">" + strings[n] +"</span>";
            }
            listValue.add(newNodeHtml);
        }*/
        // 关闭输出文件流对象,释放资源
        Dispatch.call(spFileStream,"Close");
        Dispatch.putRef(spVoice,"AudioOutputStream",null);//此处异常

    }
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换