• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

error in executing web service

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I would like to implement a web service which display the price of a product introduced by the user. this product is stored in a data base MySQL. this is the code:


this is the errors appeared:
août 05, 2016 1:31:47 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avertissement: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:affiche_prix' did not find a matching property.
août 05, 2016 1:31:47 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avertissement: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:affiche_prixClient' did not find a matching property.
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Server version:        Apache Tomcat/7.0.70
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Server built:          Jun 15 2016 16:27:45 UTC
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Server number:         7.0.70.0
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: OS Name:               Windows NT (unknown)
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: OS Version:            6.2
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Architecture:          x86
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Java Home:             C:\Program Files (x86)\Java\jre7
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: JVM Version:           1.7.0_05-b06
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: JVM Vendor:            Oracle Corporation
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: CATALINA_BASE:         C:\Users\PC_COMPANY\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: CATALINA_HOME:         C:\Users\PC_COMPANY\Downloads\apache-tomcat-7.0.70
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Command line argument: -Dcatalina.base=C:\Users\PC_COMPANY\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Command line argument: -Dcatalina.home=C:\Users\PC_COMPANY\Downloads\apache-tomcat-7.0.70
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Command line argument: -Dwtp.deploy=C:\Users\PC_COMPANY\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Command line argument: -Djava.endorsed.dirs=C:\Users\PC_COMPANY\Downloads\apache-tomcat-7.0.70\endorsed
août 05, 2016 1:31:47 PM org.apache.catalina.startup.VersionLoggerListener log
Infos: Command line argument: -Dfile.encoding=Cp1252
août 05, 2016 1:31:47 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
Infos: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Sony\VAIO Improvement\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;.
août 05, 2016 1:31:47 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["http-bio-8080"]
août 05, 2016 1:31:47 PM org.apache.coyote.AbstractProtocol init
Infos: Initializing ProtocolHandler ["ajp-bio-8009"]
août 05, 2016 1:31:47 PM org.apache.catalina.startup.Catalina load
Infos: Initialization processed in 534 ms
août 05, 2016 1:31:47 PM org.apache.catalina.core.StandardService startInternal
Infos: Démarrage du service Catalina
août 05, 2016 1:31:47 PM org.apache.catalina.core.StandardEngine startInternal
Infos: Starting Servlet Engine: Apache Tomcat/7.0.70
août 05, 2016 1:31:47 PM org.apache.catalina.startup.TldConfig execute
Infos: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
août 05, 2016 1:31:48 PM org.apache.catalina.startup.TldConfig execute
Infos: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
août 05, 2016 1:31:48 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
Avertissement: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
août 05, 2016 1:31:48 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["http-bio-8080"]
août 05, 2016 1:31:48 PM org.apache.coyote.AbstractProtocol start
Infos: Starting ProtocolHandler ["ajp-bio-8009"]
août 05, 2016 1:31:48 PM org.apache.catalina.startup.Catalina start
Infos: Server startup in 1187 ms
août 05, 2016 1:31:50 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
Avertissement: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
impossible de se connecter à la base

 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the MySQL JDBC jar file in the classpath?

You ought to use connection pool for database connections, done in Tomcat context.xml config file.

Also you should use PrepareStatement for sql.
 
boutheina gherib
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already included the Mysql JDBC in the classpath
 
Sheriff
Posts: 28409
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think anything in that log file is related to your error. Although... you didn't exactly say what your error is. Perhaps you could explain your error in some detail. Such as: what did you expect to happen? What happened instead?

Your code is hard to read, because the indentation is random. But maybe your code looks properly indented to you and it just comes out as a mess when you put it in the code tags here? At any rate I would expect that code to throw an SQLException, which you should see in some log file somewhere. You have made all of the usual errors made by people new to JDBC and some others as well, although the commented-out code also obscures one of the problems.

However if your web service is never called then you will never see any SQLException. That could be your problem too.
 
Marshal
Posts: 4808
602
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be importing java.sql.Connection and java.sql.Statement rather than com.mysql.jdbc.Connection and com.mysql.jdbc.Statement
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ad others have said before, you need more information on the cause of the exception. Currently, the catch block gives you just about no information - add an e.printStackTrace() and post its output here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic