Hello to all!
Already tortured and can not do the project.
Need help from the community.

What do I need to do?

I need to create a Web project in Java that will work with Tomcat server and Derby database.

What I've done?

Created a home directory which is located on C: \ - ( C:\home ). In this directory put the following: Tomcat, Derby, eclipse, jdk8 and workspace for the project.

It looks like my architecture - everything you need to work with the project:

 C:\home\apache-tomcat-8.0.36,<br> C:\home\db-derby-10.12.1.1-bin,<br> C:\home\eclipse,<br> C:\home\jdk8,<br> C:\home\workspace<br> 

  1. Created a project called ManagementStudent (Dynamic Web Application)

  2. Added Tomcat v8.0 in Eclipse from the directory - C:\home\apache-tomcat-8.0.36

  3. Created a new source folder called DBCreator which is located in the ManagementStudent node

    1. Created a new * .java file called CreateDatabase.java, its location: ManagementStudent/DBCreator/dbcreate/CreateDatabase.java
  4. Linked to Eclipse for ManagementStudent from derbyclient.jar, which is located at: home/db-derby-10.12.1.1-bin/lib/derbyclient.jar

  5. I wrote the appropriate code for the project and run startNetworkServer.bat, which is located at: C:/home/db-derby-10.12.1.1-bin/bin/startNetworkServer.bat

  6. From Eclipse, I run CreateDatabase.java, which is located at: ManagementStudent/DBCreator/dbcreate/CreateDatabase.java

    1. In this class there is a main method and it is responsible for creating the database.

    2. The database is created successfully, which is located in: C:\home\db-derby-10.12.1.1-bin\bin\StudentDB

  7. Then I copy it to the root of ManagementStudent: ManagementStudent / StudentDB


After the creation process, I wrote a class for DML checks and everything works well.

Now I create the following:

  1. StudentServlet.java, which is located at: ManagementStudent/src/web/students/Student.java

  2. Student.html, which is located in: ManagementStudent/WebContent/Student.html

Thereafter:

  1. Running Tomcat

  2. I launch Derby

  3. I open the web page and type: http://localhost:8080/ManagementStudent/StudentServlet

  4. I enter the data that I want to send to the server, and then save them to the database

And I encounter the following problem: the data gets to the servlet without problems, but when the servlet tries to transfer them to the Database, a lot of errors fall out.

After I googled, I realized one thing. What I need is to configure Tomcat for Derby using web.xml, which is in /ManagementStudent/WebContent/WEB-INF/web.xml and context.xml which I have to create in /ManagementStudent/WebContent/META-INF/context.xml

And also - you need to copy derby.jar and derbyClient.jar to the / lib directory in Tomcat: ( C:\home\apache-tomcat-8.0.36\lib ), and configure.

Does anyone know how all this is done so that it works. Because I already try this way and that, but it does not work.

I can send my mini-project, if necessary.

Thank you in advance!!!

A small print screen of my site:

enter image description here

    0