Philippe Ponceblanc

Ranch Hand
+ Follow
since Aug 03, 2015
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
30
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Philippe Ponceblanc

Hello,
I work with JPA in a site drive project, I encounter a problem with the @Entity annotation that gives me an error that I do not understand.

here is my source code:




Error on @Entity : The Java class for mapped type "Article" must define a non-private zero-argument constructor

I tried several syntax but I do not see where is the error!

How to do ?
I left my first project here is the picture:



Here are my different code of the image:










now i would like to understand what url i have to put to make appear the page JSP == panier.jsp.

Then compremdre the mechanism of the javabean Cart.java and my servlet WebCartServlet.java.

The project is an e-commerce site with a basket to fill!
I do not ask that the have given me the site ready in hand, but only the filling of the basket, so that I assimilate this redundant structure!
2 months ago
Hello,
I installed my project in the webapps directory of tomcat,
I have trouble understanding between the compile command and the deployment in tomcat my directory is "/opt/apache-tomcat-8.5.34/webapps/fun/exo103/".
at the moment my servlet does not display a JSp page via the doGet method, but I have a 404 error!

how to differentiate the command >> javac myservlet
how to deploy in tomcat >> catalina
2 months ago

Tim Moores wrote:No editing - you compile the .java file which results in a .class file. The IDE does that for you, but it's possible it doesn't put the class files where they need to be. But after compilation they should be somewhere in the project folder, provided there were no errors.




I have no more error after compiling with Tomcat, I can not find the files.class!
Should you add a "target" directory for the tomcat?
to generate .class files in the "target" directory?
3 months ago

Tim Moores wrote:A source file does no good in WEB-INF/classes - that's were the class file needs to be.



I follow a certification EE java, but it is this exercise that is imposed.
It starts in this form previously written.
how can i edit my .class files instead of .java
3 months ago
hello ;

i have :

project -Web-INF/classes
               - webcart
                    - Cart.java
                    - WebCartServlet.java
          - Meta-INF
              - context.xml
         - WEB-INF
               - classes
                 -  webcart
                    - Cart.java
                    -WebCartServelet.java
              - panier.jsp
              - web.xml
         
3 months ago
I'm using tomcat 8.5, I generated a project as follows:

WEB-INF / classes / WebCart / WebCartServlet.java

likewise I added the jsp and the web.xml

now I have a 404 error!
3 months ago
eclipse == /src/webcart/WebCartServlet.class
3 months ago
no, in the package webcart
3 months ago
may be a language error:
1 / us
2 / fr
3 months ago
in /src/webcart/WebCartServlet
3 months ago
Hello,
I boque on a simple servlet that I can not invoke, with appal of a JSP page. I have tried everything :
- parameters of the web.xml
- JSP

here is my code:

1/ servlet


2/ Web.xml



3/ my JSP



Error 500

3 months ago

it misses this code


to initialize RouteId
but I do not know where to put it?
When Route is new, its RouteId id has never been initialized.

How do you see the coding to initialize the RouteId?
what should you do?
Hello,
I work with the website “openfights.org” I import my data.
I have a persistence “MyApp”, 4 classes: Aireline, Airport, Route and RouteId. I use H2 as a database. I have an ImportData class to import my data from the openfights.org site.
When importing Aireline and Airport data are well filled.
the problem is that for the class Route I had to do a RouteId class because I have several primary keys.
Hibernate raises an exception.

Route class



RouteId class



here is my method of importing Routes



Hibernate Debug :

Hibernate: insert into Airline (active, alias, callsign, country, iata, icao, name, airlineId) values (?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Airline (active, alias, callsign, country, iata, icao, name, airlineId) values (?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into Airline (active, alias, callsign, country, iata, icao, name, airlineId) values (?, ?, ?, ?, ?, ?, ?, ?)
DEBUG (ImportData.java) - Stream opened to [https://raw.githubusercontent.com/jpatokal/openflights/master/data/routes.dat]
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Could not set field value [410] value by reflection : [class flights.RouteId.airlineId] setter of flights.RouteId.airlineId
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:787)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:765)
at ImportData.importFromSource(ImportData.java:199)
at ImportData.main(ImportData.java:230)
Caused by: org.hibernate.PropertyAccessException: Could not set field value [410] value by reflection : [class flights.RouteId.airlineId] setter of flights.RouteId.airlineId
at org.hibernate.property.access.spi.SetterFieldImpl.set(SetterFieldImpl.java:58)
at org.hibernate.mapping.Component$ValueGenerationPlan.execute(Component.java:419)
at org.hibernate.id.CompositeNestedGeneratedValueGenerator.generate(CompositeNestedGeneratedValueGenerator.java:97)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105)
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:780)
... 3 more
Caused by: java.lang.NullPointerException
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57)
at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:75)
at java.lang.reflect.Field.set(Field.java:764)
at org.hibernate.property.access.spi.SetterFieldImpl.set(SetterFieldImpl.java:38)
... 11 more