M
M
Maks Burkov2016-07-02 23:35:22
Java
Maks Burkov, 2016-07-02 23:35:22

Java.lang.NoClassDefFoundError?

I can't figure out why I'm getting an error, everything seems to be in place.

import connection.pool.ConnectionPool;
import coupon.beans.User;
import coupon.exceptions.DuplicateUser;
import system.exceptions.CouponSystemException;

@Path("/register")
public class Register {

Connection con;

@POST
@Consumes(MediaType.APPLICATION_JSON)
public void Registering(User user) throws CouponSystemException, DuplicateUser, IOException{

    ConnectionPool con_pool = ConnectionPool.con_instance;

    String register = "INSERT INTO user(nickname,first_name,last_name,password,email,type)values(?,?,?,?,?,?)";

    PreparedStatement pre;
    try {

        pre = con.prepareStatement(register);
        pre.setString(1,user.getNickName());
        pre.setString(2,user.getFirstName());
        pre.setString(3,user.getLastName());
        pre.setString(4,user.getEmail());
        pre.setString(5,user.getPassword());
        pre.setObject(6,user.getType());
        pre.execute();


    }catch(com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException e){

        throw new DuplicateUser("Sorry but this user is already exist");

    }catch (SQLException e1) {

        throw new CouponSystemException("You have some problems that need to be fixed with your database..");
    }
    finally{

    con_pool.returnConnection(con);


    try {
        con.close();
    } catch (SQLException e) {

        throw new CouponSystemException("You have some problems that need to be fixed with your database..");
    }
  }


java.lang.NoClassDefFoundError: system/exceptions/CouponSystemException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructors(Unknown Source)
    at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:111)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:745)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.createAbstractResourceModelStructures(WebApplicationImpl.java:1522)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1295)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: system.exceptions.CouponSystemException
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
    ... 39 more


0e932465d21c41dfb4e6391dbaeb36e6.png

9bf747b112d1472cb2b438e33c745c8e.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2016-09-26
@Terran37

Look, there should be an indication in the logs of the error line in the Register class.

G
goshan_p, 2017-09-21
@goshan_p

You already have quite a few libraries, I would start using maven/gradle if I were you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question