Мой вопрос о java.lang.NoClassDefFoundError - PullRequest
0 голосов
/ 23 октября 2018

На моем локальном компьютере мой API отдыха работает отлично.Но я размещен на сервере.Затем, когда я вызываю метод post, возвращается ошибка.Но метод GET работает отлично.Оба метода работают на моем локальном компьютере. Это моя ошибка

Ниже приводится мой POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.Mobios</groupId>
    <artifactId>DigitalWallet</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.0.9.RELEASE</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.0.9.RELEASE</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>5.0.9.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>5.0.9.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.3.6.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.12.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.12</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.thetransactioncompany/cors-filter -->
        <dependency>
            <groupId>com.thetransactioncompany</groupId>
            <artifactId>cors-filter</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.2</version>
                    <configuration>
                        <warSourceDirectory>src/main/webapp</warSourceDirectory>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

И это мой метод

@RequestMapping(value = "/origin/sendcredit/", method = RequestMethod.POST)
    // @Transactional(rollbackFor = DWException.class)
    public String addSubCredit(
            @RequestBody AddMoneyToOriginVM sendCreditToOriginVM/* ,@RequestParam("hashedValue") String hashedValue */,
            HttpServletResponse response) throws Exception {
        // checkPlainAndHashed.check("ascc","cdscwc");
//      Log4JUtil.logger.info("SendCredit|Start|Transaction=" + sendCreditToOriginVM.toString() + "|"
//              + sendCreditToOriginVM.getSender_mobile_number() + " to "
//              + sendCreditToOriginVM.getReceiver_mobile_number() + " amount " + sendCreditToOriginVM.getAmount() + "|"
//              + sendCreditToOriginVM.getTransaction_Type_id());
        String Text = "";
        try {
            String receiver = sendCreditToOriginVM.getReceiver_mobile_number();
            String sender = sendCreditToOriginVM.getSender_mobile_number();

            int pin = sendCreditToOriginVM.getSender_pin();
            double amount = sendCreditToOriginVM.getAmount();
            try {
                Origin dbReceiver = originService.findByNumber(receiver);
                Origin dbSender = originService.findByNumber(sender);
                if (originService.findByNumberAndPin(sender, pin) != null) {
                    double a = Double.parseDouble(encodeDecode.Decode(dbSender.getWallet().getAmount()));
                    if (a < amount) {
                        throw new InsufficientBalanceException();
                    } else {
                        if (dbReceiver == null) {
                            OriginVM newOrigin = new OriginVM();
                            newOrigin.setMobile_number(receiver);
                            newOrigin.setOrigin_types_id(3);
                            newOrigin.setSuper_mobile_number(sender);
                            newOrigin.setStatus_id(1);
                            newOrigin.setSuper_pin(pin);
                            newOrigin.setWallet_amount(amount);
                            newOrigin.setMembership_types_id(5);
                            newOrigin.setTransaction_Type_id(1);
                            addOrigin(newOrigin, response);

                        } else {
                            SaveTransaction(dbSender, dbReceiver, amount, 2, "Debit", "Credit");
                        }
                        dbReceiver = originService.findByNumber(receiver);
                        dbSender = originService.findByNumber(sender);
                        try {
                            Text = "0|Transaction Successfull"
                                    + encodeDecode.Decode(String.valueOf(dbReceiver.getWallet().getAmount())) + "|"
                                    + encodeDecode.Decode(String.valueOf(dbSender.getWallet().getAmount()));
                        } catch (Exception e) {

                            throw new RuntimeException("Roll Me Back");
                        }

                        Log4JUtil.logger.info("SendCredit|End|Transaction=" + sendCreditToOriginVM.toString() + "|"
                                + sendCreditToOriginVM.getSender_mobile_number() + " to "
                                + sendCreditToOriginVM.getReceiver_mobile_number() + " amount "
                                + sendCreditToOriginVM.getAmount() + "|"
                                + sendCreditToOriginVM.getTransaction_Type_id());
                    }
                } else {
                    throw new AgentValidationFailedException();
                }
            } catch (DWException exp) {
                throw exp;
            }
        } catch (DWException ex) {
//          Log4JUtil.logger.info("Origine|Exception|Transaction=" + sendCreditToOriginVM.toString() + "|"
//                  + sendCreditToOriginVM.getSender_mobile_number() + " to "
//                  + sendCreditToOriginVM.getReceiver_mobile_number() + " amount " + sendCreditToOriginVM.getAmount()
//                  + "|" + ex.toString());
            response.sendError(ex.getErrorCode(), ex.getErrorMessage());
        }
        return Text;
    }

Это версия Java для сервераopenjdk версия "1.8.0_191" Среда выполнения OpenJDK (сборка 1.8.0_191-b12) Виртуальная 64-битная серверная виртуальная машина OpenJDK (сборка 25.191-b12, смешанный режим)

...