An warware: javax.xml.bind babu shi

Da farko da gabatarwa, kuskuren "javax.xml.bind ba ya wanzu" yana ษ—aya daga cikin matsalolin da masu haษ“akawa ke fuskanta lokacin da ake canjawa daga tsoffin juzu'in Java zuwa sababbi, musamman daga Java 8 zuwa Java 9, ko kuma sabo. A lokacin wannan canji, kuna iya ci karo da wannan saฦ™on da ke nuni da cewa wani fakitin ya ษ“ace, musamman saboda an cire javax.xml.bind a Java 9, kuma an cire shi daga Java 11.

Ana amfani da `javax.xml.bind` don Architecture na Java don daurin XML (JAXB). Ana aiki dashi don canza abubuwan Java zuwa XML kuma akasin haka. Muhimmancin JAXB ba za a iya wuce gona da iri ba, saboda yana ba da hanyoyin da ba za a iya warwarewa ba, marshal da ingantattun ayyuka.

Matsalolin JDK da Magani

Babban dalilin wannan saฦ™on kuskure shine tare da sakin Java SE 9 da tsarin tsarin, an cire wasu fakiti daga hanyar da aka saba, gami da `javax.xml.bind`.

Don gyara mai sauri da ษ—an lokaci, zaku iya amfani da zaษ“in layin umarni na `โ€“add-modulesโ€™ idan kuna gudanar da shirin ku daga layin umarni. Don Maven da sauran makamantan kayan aikin gini, zaku iya ฦ™ara abubuwan dogaro kai tsaye a cikin fayil ษ—in pom.xml ko build.gradle.

<!-- This command tells Java to add the 'java.xml.bind' module to your classpath -->
java --add-modules java.xml.bind YourApp

Koyaya, don ฦ™arin bayani na dindindin, musamman idan kuna shirin ฦ™aura ayyukanku zuwa Java 11 da kuma bayan haka, dole ne ku haษ—a ษ—akin karatu na JAXB (javax.xml.bind) da hannu a cikin hanyar aikinku.

ฦ˜ara Dogaran JAXB, Mataki-mataki

Don haษ—a JAXB a cikin aikinku, da farko kuna buฦ™atar ฦ™ara dogaro da `jaxb-api` zuwa pom.xml ko build.gradle. Ana samar da aiwatar da JAXB a cikin ma'ajiyar ta `com.sun.xml.bind`.

<!-- In pom.xml, add the following dependencies -->
<dependencies>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.3.0.1</version>
    </dependency>
</dependencies>

Bayan haษ—a waษ—annan abubuwan dogaro a cikin aikin ku, ya kamata a warware batun ku tare da "javax.xml.bind ba ya wanzu".

Fahimtar Tasirin Canje-canje a cikin Java 9 da Beyond

Java 9 ya gabatar da sabon tsarin tsarin wanda ya yi tasiri sosai kan yadda masu haษ“akawa ke ginawa da sarrafa aikace-aikacen su. Ta hanyar yin fakiti kamar `javax.xml.bind` ba za a iya samun su ta tsohuwa ba, an tilasta wa masu haษ“akawa su kasance da hankali game da dogaro da ayyukansu.

Wannan canjin, ko da yake yana daษ—aษ—awa a farko, ya ฦ™are yana ฦ™arfafa kyakkyawan aiki a gudanar da dogaro, yana sa ayyukan su zama masu ฦ™arfi da sauฦ™in kiyayewa a cikin dogon lokaci.

Wannan ya ce, waษ—annan canje-canjen suna nufin cewa masu haษ“akawa suna buฦ™atar sanin kansu da sabon tsarin tsarin da yadda ake sarrafa abin dogaro a sarari. Amma tare da wasu ayyuka, magance batutuwan da suka shafi bacewar kayayyaki a cikin Java 9 da kuma bayan sun zama abin sarrafawa, har ma da yanayi na biyu.

Wannan daidaitawa ga tsarin ฦ™irar Java shaida ce ga haษ“akar yanayin fasaha da ikon masu haษ“akawa don daidaitawa da canje-canje tare da sabbin ayyuka.

Shafi posts:

Leave a Comment