如何解决此Java错误“ java.io.IOException:无效的常量类型:19 at 3”

时间:2019-07-17 11:39:28

标签: java

我正在使用Eclipse IDE和Java 8

  • 此方法:
public static XMLElement binToXmlPivot(byte[] binMsg, 
    String protocolName, String release, 
    String version, String messageName)
throws ProtocolNotFoundException, MessageNotFoundException, MalformedDialogueException {};
  • 此方法上方的命令行是“ Traiter message”。
LktTools.binToXmlPivot("".getBytes(), protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get());

====>此错误消息

java.io.IOException: invalid constant type: 19 at 3
    at javassist.bytecode.ConstPool.readOne(ConstPool.java:1241)
    at javassist.bytecode.ConstPool.read(ConstPool.java:1172)
    at javassist.bytecode.ConstPool.<init>(ConstPool.java:185)
    at javassist.bytecode.ClassFile.read(ClassFile.java:807)
    at javassist.bytecode.ClassFile.<init>(ClassFile.java:148)
    at com.impetus.annovention.Discoverer.discover(Discoverer.java:150)
    at com.jware.jwf.scf.DiscoverClassPathTask.call(DiscoverClassPathTask.java:454)
    at com.jware.jwf.scf.DiscoverClassPathTask.call(DiscoverClassPathTask.java:55)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

1 个答案:

答案 0 :(得分:0)

我使用过Java8,并且正在尝试使用所有这些版本的javassist:3.17.0-GA, 3.22.0-GA, 3.18.2.GA, 3.22.0-CR2 但是不行!
///////这是我遇到问题时的方法

public void traiterMessage(final HashMap cmdMap){         // Donnees d'entree         最后的String protocolInName =(String)cmdMap.get(CmdConfig.PROTOCOL_IN_NAME.get());         最后的String protocolInRelease =(String)cmdMap.get(CmdConfig.PROTOCOL_IN_RELEASE.get());         最后的String protocolInVersion =(String)cmdMap.get(CmdConfig.PROTOCOL_IN_VERSION.get());

    // Utilitaires
    final NEXV6ToCBAuUtils convUtils = new NEXV6ToCBAuUtils(cmdMap);

    // Logger
    final LoggerUtils logger = new LoggerUtils(cmdMap, getClass());
    final OmegaUtils omegaUtils = new OmegaUtils(cmdMap);

    // Nom de la fonction
    final String functionName = convUtils.currentFunctionToStr();

    logger.info(Log.FUNCTION_START, functionName);

// au niveau de lkt le bugaffiché         尝试{

        System.out.println("avant message lkt tools");

         //byte[] MessageTest = omegaUtils.getTPEMessageRq();
        // String MessageTest1="";
        // System.out.println("Message arrived"+ MessageTest);

        // Message provenent du TPE
            String messageInToString = new String(omegaUtils.getTPEMessageRq(), Const.FORMAT_ENCODING.get());
            messageInToString = convUtils.convertOriginMsgNexoToDictionaryMsg(messageInToString, Message.GENERIC_IN.get());
         System.out.println("message converti"+messageInToString);

        //ici le probleme 

       LktTools.binToXmlPivot("".getBytes(), protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get());


    // System.out.println("test LKT tools amina :"+LktTools.binToXmlPivot(MessageTest, protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get()));

        //LktTools.binToXmlPivot(messageInToString.getBytes(), protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get());

        //System.out.println("test LKT tools amina :"+LktTools.binToXmlPivot(messageInToString.getBytes(), protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get()));
        //test by amina
        //System.out.println("test LKT tools amina :"+LktTools.binToXmlPivot("".getBytes(), protocolInName, protocolInRelease, protocolInVersion, Message.GENERIC_IN.get()));


        // Recuperation du Protocol
        final Protocol protocolIn = Protocol.fromValue(protocolInName);

        cmdMap.put(CmdConfig.PROTOCOL_IN.get(), protocolIn);

        // Recuperation de l'arbre de decision
        final ActionsTree actionTree = protocolIn.getActionTreeInstance();

        // Ajout d'une map pour stocker les messages pour les comptes rendu
        if (cmdMap.get(Const.MAP_TRANSPORTEURS_MAP.get()) == null) {
            cmdMap.put(Const.MAP_TRANSPORTEURS_MAP.get(), new LinkedHashMap<Message, TransporteurBean>());
        }

        /*
         * Recuperation du messageId
         */
        String messageId = "";

        // Recherche du messageID dans la trame par regex
        Pattern pattern = Pattern.compile(ConstNEXOV6.REGEX_MSG_ID.get());
        Matcher match = pattern.matcher(messageInToString);

        if (match.find(1)) {
            messageId = match.group(1);
        }

        // Conversion en message
        final Message message = Message.fromIdAndProtocol(messageId, protocolIn);

        // Ajout de la prochaine action
        actionTree.setNextAction(cmdMap, message);
    } catch (Exception exc) {
        logger.info(Log.FUNCTION_ERROR, functionName);
    }
    logger.info(Log.FUNCTION_END, functionName);
}