K
K
kirawa2016-03-02 10:03:45
Java
kirawa, 2016-03-02 10:03:45

How to run a web project (war file) from under the console?

Hello, I need to implement a restful service that fetches data from a database using JPA. I used netbeans and created a database in services, then I created entity classes over the database and the restful service itself. In principle, everything works from under netbeans, but I need to implement it in such a way that it would be as easy as possible to start the server using a war file. What I have:
1) There is a war file with compiled project files
2) There is a folder with a derby database with extensions .dat and .lck
I tried to run the war file using glassfish-4.1. I am not configured to connect to javaDB or I need to start the server from the console too. In general, this is the question of how I can run the entire project from under the console.

!!! ADD THAT IF IN NEtbeans I RUN JAVA db MANUALLY, THEN THE WAR FILE ON THE SERVER WORKS!!!!
HERE IS THE LOG

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.ejb.EJBException
root cause

javax.ejb.EJBException
root cause

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: ??? ???????? ??????????.
Error Code: 40000
Call: SELECT ORDERS_ID, TIME, ITEM_ID FROM ORDERS
Query: ReadAllQuery(referenceClass=Orders sql="SELECT ORDERS_ID, TIME, ITEM_ID FROM ORDERS")
root cause

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: ??? ???????? ??????????.
Error Code: 40000
Call: SELECT ORDERS_ID, TIME, ITEM_ID FROM ORDERS
Query: ReadAllQuery(referenceClass=Orders sql="SELECT ORDERS_ID, TIME, ITEM_ID FROM ORDERS")
root cause

java.sql.SQLNonTransientConnectionException: ??? ???????? ??????????.
root cause

org.apache.derby.client.am.SqlException: ??? ???????? ??????????.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evhen, 2016-03-02
@EugeneP2

Spring-Boot is here to help. At the output, you get an executable jar file, in which the already built-in tomcat / jetty wakes up. And everything works great.
You can run pure jetty and the launch will look something like this
java -jar jetty-runner.jar my.war

E
Evgeny, 2016-03-02
@zolt85

War file is nothing more than just an archive. How do you imagine launching the archive from the console? Well, it's a lyric. In order for the application to work, you need an application server (GlassFish, Tomcat, etc.). Everything starts from NetBeans, because the NetBeans developers took care of it, and they used an embedded solution (the same Tomcat) to start your application. Accordingly, the conclusion is: install an application server (I still recommend Tomcat), deploy your application into it, and enjoy life.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question