2014-06-13 2 views
1

작업을 시작할 때이 오류가 발생합니다. 내 로컬 컴퓨터에서 작동하지만 서버에서 tomcat7에 war 파일을 업로드하면 오류가 발생합니다. 응용 프로그램이 시작되었지만 런타임에 실패합니다.

코드,

ProcessBuilder pb = new ProcessBuilder(commands); 
    File log = new File(this.logFilePath); 

    if (!log.exists()) { 
     log.getParentFile().mkdirs(); 
    } 

    pb.redirectErrorStream(true); 
    pb.redirectOutput(Redirect.appendTo(log)); 
    Process p = pb.start(); 

및 스택 트레이스 처음

ERROR: org.springframework.batch.core.step.AbstractStep - Encountered an error executing step eu.createBatchStep in job eu 
java.lang.NoClassDefFoundError: java/lang/ProcessBuilder$Redirect 
    at com.stockopedia.symfony.Symfony.run(Symfony.java:105) 
    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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132) 
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
    at sun.proxy.$Proxy29.run(Unknown Source) 
    at com.stockopedia.batch.foundation.tasklets.SystemCommandTasklet.execute(SystemCommandTasklet.java:54) 
    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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132) 
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
    at sun.proxy.$Proxy22.execute(Unknown Source) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:402) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:326) 
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) 
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:267) 
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77) 
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368) 
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) 
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) 
    at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:253) 
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198) 
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) 
    at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) 
    at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67) 
    at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:162) 
    at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:141) 
    at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134) 
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304) 
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:679) 

파일이 존재하지 않기 때문에 나는 그것이 될 수 있지만,하지만 난 수동으로 파일을 생성하지만, 여전히 같은 점점 시도 오류.

+3

어떤 자바 버전을 사용하십니까? 'ProcessBuilder.Redirect'는 자바 7에서 사용할 수 있습니다. – Jens

+0

자바 버전 "1.6.0_27" OpenJDK 런타임 환경 (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.11.10.1) OpenJDK 64 비트 서버 VM 20.0-b12, 혼합 모드) – vishal

+0

hmm redirectOutput은 Java 6에서 지원되지 않습니까? – vishal

답변

0

클래스 경로에 리디렉션 리디렉션을 찾을 수 없다는 오류가 발생합니다.

이 클래스는 Java 1.7you can check it there에서 사용할 수 있으므로 이전 버전의 Java에서는 사용할 수 없습니다.

개발 환경에서 Java 1.7 이상을 사용한다고 가정하겠습니다.하지만 Tomcat은 Redirect class 및 redirectOutput (Redirect) 메소드가없는 Java 1.6에서 실행됩니다.

서버에서 Java를 업그레이드하거나 Java 1.6 전용 API를 사용하십시오.