-2

私はEclipseでMavenプロジェクトを開発しています。最初にDAOレイヤーを作成してから検証しました-これは正常に機能します。しかし、プロジェクトにjarを追加すると(他のレイヤー(ビジネス)用)、DAOレイヤーが意図したとおりに機能しません。

このjarを追加するとエラーが発生します:[func_frwmwk_clt,func_frwmwk_cmn,func_frwmwk_srv, func_util, ott_utilities, soi, toplink ]しかし、これを削除すると、プロジェクトは機能し、真の結果が得られます。どうすればこれを修正できますか?


メインクラス:

package com.services;
import com.entity.Ws_security;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


 import com.services.Interface_ws_security_services;

public class App {




@SuppressWarnings("resource")
public static void main(String[] args) {


ApplicationContext ctx1 = new  ClassPathXmlApplicationContext("spring_hibernate.xml");
                                                                        Interface_ws_security_services service=(Interface_ws_security_services)ctx1.getBean("a");

    //Ws_security ess=new Ws_security();

    System.out.println("Done");
    Ws_security ess =service.findByidws("ess1");
    System.out.println(ess.getLogin());
    System.out.println(ess.getPassword());
    System.out.println(ess.getIPmax());
    System.out.println(ess.getIPmin());
    System.out.println("Done");


}

   }

エラーログ:

log4j:WARN No appenders could be found for     logger(org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Exception in thread "main" org.springframework.beans.factory.BeanCreationException:   Error creating bean with name 'disableServiceBoxPageController' defined in URL [jar:file:/C:/Users/sayed/Desktop/DocumentationR3_33276/Client/lib/func_frwmwk_clt.jar!/com/lhs/ccb/cfw/sgu/solutionunits/servicebox/DisableServiceBoxPageController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.lhs.ccb.cfw.sgu.solutionunits.servicebox.DisableServiceBoxPageController]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.lhs.ccb.func.ect.DefaultDictionary cannot be cast to com.lhs.ccb.cfw.wcs.errorhandling.CFWErrorDictionary
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1007)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:953)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.services.App.main(App.java:19)
  Caused by: org.springframework.beans.BeanInstantiationException: Could not   instantiate bean class [com.lhs.ccb.cfw.sgu.solutionunits.servicebox.DisableServiceBoxPageController]: Constructor threw exception; nested exception is java.lang.ClassCastException: com.lhs.ccb.func.ect.DefaultDictionary cannot be cast to com.lhs.ccb.cfw.wcs.errorhandling.CFWErrorDictionary
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1000)
... 13 more
    Caused by: java.lang.ClassCastException: com.lhs.ccb.func.ect.DefaultDictionary   cannot be cast to com.lhs.ccb.cfw.wcs.errorhandling.CFWErrorDictionary
at com.lhs.ccb.cfw.wcs.solutionunit.AbstractPageController.<init>(Unknown Source)
at com.lhs.ccb.cfwutil.ExtendedAbstractPageController.<init>(Unknown Source)
at com.lhs.ccb.cfw.sgu.solutionunits.servicebox.DisableServiceBoxPageController.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 15 more

しかし、なぜこのjarが呼び出され、クラスのメインがこのリストのjarを機能させなかったのか理解できません

4

2 に答える 2

1

DisableServiceBoxPageControllerのコンストラクタにエラーがあります。DefaultDictionaryaを aにキャストしようとしていますがCFWErrorDictionary、それは不可能のようです。

問題のある行を検索し、可能であればオブジェクトを適切な型にキャストします。


編集

問題が JAR 自体の追加に関連している場合は、クラスが競合している可能性があります。同じ JAR の複数のバージョンを使用していないことを確認してください。

于 2013-07-29T18:40:57.510 に答える
0

ビジネス層に必要なファイルを別のディレクトリに配置してみてください。

于 2013-07-29T18:37:34.200 に答える