help, pinyin4j problem

lin zy
2010-06-18
2012-10-20
  • lin zy
    lin zy
    2010-06-18

    hi, when I use pinyin4j-2.5.0.jar, I encountered a problem.
    when i run testcase, there is no problem, but in a resin app, it throws
    exception as follow:

    and my JDK is 1.6, resin 3.1.9,

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultA
    ctionInvocation.java:404)
    at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(Defa
    ultActionInvocation.java:267)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:229)
    at com.hisupplier.commons.struts2.ExceptionInterceptor.intercept(Excepti
    onInterceptor.java:59)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.hisupplier.cn.basic.BasicInterceptor.intercept(BasicInterceptor.j
    ava:72)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doInte
    rcept(DefaultWorkflowInterceptor.java:221)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
    (MethodFilterInterceptor.java:86)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(V
    alidationInterceptor.java:150)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterce
    ptor.doIntercept(AnnotationValidationInterceptor.java:48)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
    (MethodFilterInterceptor.java:86)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.interc
    ept(ConversionErrorInterceptor.java:123)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.hisupplier.commons.struts2.HiParametersInterceptor.doIntercept(Hi
    ParametersInterceptor.java:202)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
    (MethodFilterInterceptor.java:86)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.inter
    cept(StaticParametersInterceptor.java:105)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(Checkbox
    Interceptor.java:83)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUp
    loadInterceptor.java:207)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(
    ModelDrivenInterceptor.java:74)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.inte
    rcept(ScopedModelDrivenInterceptor.java:127)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.interceptor.ProfilingActivationInterceptor.interce
    pt(ProfilingActivationInterceptor.java:107)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.interce
    pt(DebuggingInterceptor.java:206)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(Cha
    iningInterceptor.java:115)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInt
    erceptor.java:143)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(Pr
    epareInterceptor.java:121)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
    (MethodFilterInterceptor.java:86)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(Ser
    vletConfigInterceptor.java:170)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasI
    nterceptor.java:123)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at com.opensymphony.xwork2.interceptor.TimerInterceptor.invokeUnderTimin
    g(TimerInterceptor.java:125)
    at com.opensymphony.xwork2.interceptor.TimerInterceptor.intercept(TimerI
    nterceptor.java:112)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:224)
    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
    ActionInvocation.java:223)
    at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
    erStack.java:455)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
    nvocation.java:221)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.j
    ava:50)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.jav
    a:504)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatc
    her.java:422)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterCha
    in.java:87)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilt
    er.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilte
    r.java:55)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterCha
    in.java:87)
    at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionCon
    textCleanUp.java:99)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterCha
    in.java:87)
    at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterC
    hain.java:97)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocatio
    n.java:265)
    at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatc
    herImpl.java:293)
    at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatc
    herImpl.java:111)
    at org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl
    .java:176)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewrit
    eFilter.java:728)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterCha
    in.java:87)
    at com.hisupplier.cas.CASFilter.chain(CASFilter.java:166)
    at com.hisupplier.cas.CASFilter.doFilter(CASFilter.java:161)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterCha
    in.java:87)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain
    .java:187)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocatio
    n.java:265)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273
    )
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.NoClassDefFoundError:
    net/sourceforge/pinyin4j/PinyinHelper

    at com.hisupplier.cn.category.PinYinUtil.getFirstPinYin(PinYinUtil.java:
    31)
    at com.hisupplier.cn.category.CategoryUtil.getListByAlpha(CategoryUtil.j
    ava:633)
    at com.hisupplier.cn.category.CategoryUtil.getListByAlpha(CategoryUtil.j
    ava:616)
    at com.hisupplier.cn.category.CategoryService.getCategoryList(CategorySe
    rvice.java:69)
    at com.hisupplier.cn.category.CategoryService$$FastClassByCGLIB$$6a1cb75
    6.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocatio
    n.invokeJoinpoint(Cglib2AopProxy.java:696)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
    ReflectiveMethodInvocation.java:149)
    at org.springframework.transaction.interceptor.TransactionInterceptor.in
    voke(TransactionInterceptor.java:106)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
    ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
    e(ExposeInvocationInterceptor.java:89)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
    ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterc
    eptor.intercept(Cglib2AopProxy.java:631)
    at com.hisupplier.cn.category.CategoryService$$EnhancerByCGLIB$$a4a08e53
    .getCategoryList(<generated>)
    at com.hisupplier.cn.category.CategoryAction.category_list(CategoryActio
    n.java:29)
    ... 134 more
    Caused by: java.lang.ClassNotFoundException:
    net.sourceforge.pinyin4j.PinyinHelp
    er in EnvironmentClassLoader
    at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.jav
    a:1224)
    at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.jav
    a:1203)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 149 more

     
  • lin zy
    lin zy
    2010-06-18

    Note 2 below
    1. java.lang.reflect.InvocationTargetException

    1. Caused by: java.lang.NoClassDefFoundError: net/sourceforge/pinyin4j/PinyinHelper

    3 Caused by: java.lang.ClassNotFoundException:
    net.sourceforge.pinyin4j.PinyinHelper in EnvironmentClassLoader

    I am sure that I had import pinyin4j-2.5.0.jar