12 Replies Latest reply on May 7, 2018 10:56 AM by Laury

    HTTP Status 404 and unable to get database connection

    Laury

      Hi,

       

      I do not know if I posted this case in the right forum, as it is a mix of Networking, Database, ORDS, APEX.

       

      I have a Jaasper Reports Integration application deployed om Tomcat 9, using ORDS 17.

       

      This application should be able to connect to a PDB database, and the conenction is to be found in the context.xml file in META-INF$, for that application in Tomcat.

       

      I have the following Java connection:

       

      url="jdbc:oracle:thin:@//192.168.1.105:1521/HADES"

      username="APEXDEV"

      password="demo"

       

      The application is called through the use of an url:

       

      http://192.168.1.106:8090/JasperReportsIntegration

       

      Calling this url, I get the error:

       

      HTTP Status 404 - /JasperReportsIntegration/

       

      Looking in the Catalina.out file of Tomcat, I get:

       

      02-Apr-2018 17:00:18.335 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:

      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JasperReportsIntegration]]

              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158)

              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)

              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)

              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)

              at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:951)

              at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1819)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

              at java.util.concurrent.FutureTask.run(FutureTask.java:266)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

              at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.NoSuchMethodError: oracle.i18n.text.OraBoot.getCharsetMaxCharLen(Ljava/lang/String;)Ljava/lang/String;

              at oracle.sql.converter.Orai18nCharacterSetMetaData.getMaxCharLength(Orai18nCharacterSetMetaData.java:51)

              at oracle.sql.converter.CharacterSetMetaData.getRatio(CharacterSetMetaData.java:1265)

              at oracle.jdbc.driver.DBConversion.init(DBConversion.java:178)

              at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:120)

              at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1135)

              at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)

              at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)

              at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)

              at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)

              at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)

              at org.apache.tomcat.dbcp.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)

              at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:257)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2312)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2298)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2043)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getLogWriter(BasicDataSource.java:1598)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:596)

              at org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance(BasicDataSourceFactory.java:275)

              at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)

              at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)

              at org.apache.naming.NamingContext.lookup(NamingContext.java:841)

              at org.apache.naming.NamingContext.lookup(NamingContext.java:160)

              at org.apache.naming.NamingContext.lookup(NamingContext.java:828)

              at org.apache.naming.NamingContext.lookup(NamingContext.java:174)

              at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1089)

              at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:659)

              at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:252)

              at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)

              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5097)

              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)

              ... 10 more

       

       

      From the Manager console in Tomcat, I see that the application is not started.

      If I attempt to start it manually, I get from the Tomcat server (on the page) the error:

       

      FAIL - Application at context path /JasperReportsIntegration could not be started

      FAIL - Encountered exception org.apache.catalina.LifecycleException:

      Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JasperReportsIntegration]]

       

      and in the catalina.out file:

       

      ...

      02-Apr-2018 17:06:26.003 WARNING [http-nio-8090-exec-6] org.apache.catalina.deploy.NamingResourcesImpl.cleanUp Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JasperReportsIntegration]] so no cleanup was performed for that container

      javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp].

              at org.apache.naming.NamingContext.lookup(NamingContext.java:818)

              at org.apache.naming.NamingContext.lookup(NamingContext.java:174)

              at org.apache.catalina.deploy.NamingResourcesImpl.cleanUp(NamingResourcesImpl.java:994)

              at org.apache.catalina.deploy.NamingResourcesImpl.stopInternal(NamingResourcesImpl.java:976)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:229)

              at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5435)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:229)

              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:143)

              at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1316)

              at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:669)

              at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:232)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

              at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

              at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

              at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

      ...

       

      It seems to be a connection problem.

      Is the url syntax that I use in the context.xml file correct for a PDB?

      Does someone faced already such a situation?

       

      Thanks by advance for any tip.

       

      Kind Regards

        • 1. Re: HTTP Status 404 and unable to get database connection
          Laury

          If I change the above url="jdbc:oracle:thin:@//192.168.1.105:1521/HADES" to url="jdbc:oracle:thin://192.168.1.105:1521:HADES",

          When entering that the usrl http://192.168.1.106:8090/JasperReportsIntegration in the browser, I get a page, but I do not have connection and get the error:

           

          dataSource=test2

          javax.naming.NamingException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:

          ORA-12505, TNS:listener does not currently know of SID given in connect descriptor ) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:857) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:160) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:828) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:160) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:828) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:160) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:828) at

          org.apache.naming.NamingContext.lookup(NamingContext.java:174) at

          org.apache.naming.SelectorContext.lookup(SelectorContext.java:163) at

          javax.naming.InitialContext.lookup(InitialContext.java:417) at

          de.oc.integration.jasper.webapp.Test.doGet(Test.java:97) at

          javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at

          javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at

          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:232) at

          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at

          org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at

          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at

          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at

          org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at

          org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:105) at

          org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) at

          org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at

          org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at

          org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) at

          org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at

          org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at

          org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1078) at

          org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at

          org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:760) at

          org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1524) at

          java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at

          java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at

          org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at

          java.lang.Thread.run(Thread.java:745) 

           

          that is because I do have a Service Name and not a SID.

           

          Any other idea how to solve it?

           

          Kind Regards

          • 3. Re: HTTP Status 404 and unable to get database connection
            Laury

            Hi Alli Pierre,

             

            What do you mean exactly?

             

            If I define the url for JDBC using the SID-fashion, then I get the HTML page for JasperReportsIntegration, but I am unable to run a test.

            I get a "no source found". That's expected as I do not use a SID but a Service Name (the database is a PDB).

             

            Yes, I have checked the first link you mentoned. This is about the installtion of JRI.

             

            What do you mean with the seond link?

             

            Kind Regards

            • 5. Re: HTTP Status 404 and unable to get database connection
              Laury

              Hi,

              I made use of the syntax for JDBC with a PDB :
              jdbc:oracle:thin:@//192.168.1.105:1521/HADES

              That is also the JDBC connection below in this article.
              But I get the above error.

               

              At the beginning of the article is there a mention of this JDBC syntax for a service name:
              jdbc:oracle:thin:@[HOST][:PORT]/SERVICE

               

              What is then the difference between the two syntaxes?

               

              Kind Regards

              • 6. Re: HTTP Status 404 and unable to get database connection
                Laury

                Does someone has any idea what can be the problem?

                • 7. Re: HTTP Status 404 and unable to get database connection
                  Gaz in Oz

                  Do you see the service name "HADES" in the services list when you issue the following on the database server?

                     lsnrcrtl status

                   

                  From the client machine, what do you get when you try

                     sqlplus -l !/!@hades

                  • 8. Re: HTTP Status 404 and unable to get database connection
                    Laury

                    Hi Gaz in Oz,

                     

                    1) I see that for this application, two libraries have been added on the Tomcat server (Tomcat9\lib):

                    - ojdbc6.jar
                    - orai18n.jar
                    Could this be the problem? A "too old" version of ojdbc.jar?
                    For what is orai18n.jar meant for?

                     

                    2) I will come back with the result regarding your SQL*Plus command...

                     

                    Kind Regards

                    • 9. Re: HTTP Status 404 and unable to get database connection
                      Gaz in Oz

                      Laury wrote:

                       

                      1) I see that for this application, two libraries have been added on the Tomcat server (Tomcat9\lib):

                      - ojdbc6.jar
                      - orai18n.jar
                      Could this be the problem? A "too old" version of ojdbc.jar?
                      For what is orai18n.jar meant for?

                      A "too old" version of jars might be a problem.

                      orai18n.jar contains NLS classes for object and collection types:

                      Oracle Database 11g Release 2 JDBC Driver Downloads

                      NLS classes for use with JDK 1.5, and 1.6. It contains classes for NLS support in

                      Oracle Object and Collection types. This jar file replaces the old nls_charset jar/zip files.

                      1 person found this helpful
                      • 10. Re: HTTP Status 404 and unable to get database connection
                        Laury

                        Hi Graz in Oz,

                         

                        Here the result for sqlplus:

                         

                        oel764-odb12cr2-s1:/u01/oracle/LOCAL/dba/shell$ sqlplus system@hades

                         

                        SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 20 07:29:06 2018

                         

                        Copyright (c) 1982, 2016, Oracle.  All rights reserved.

                         

                        Enter password:

                        Last Successful login time: Fri Apr 06 2018 10:13:08 +02:00

                         

                        Connected to:

                        Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

                         

                        SQL> show con_name

                         

                        CON_NAME

                        ------------------------------

                        HADES

                        SQL> !lsnrctl status | grep -i hades

                        Service "hades" has 1 instance(s).

                         

                        SQL>

                         

                        Kind Regards

                        • 11. Re: HTTP Status 404 and unable to get database connection
                          Laury

                          Hi,

                           

                          I have tried with the JDBC drivers *.jar :

                           

                          1) Oracle 11gR2 - JDK-6-7-8:

                          ojdbc6.jar

                          orai18n.jar

                           

                          2) Oracle 12cR2 - JDK8:

                          - ojdbc8.jar

                          - orai18n.jar

                           

                          I had found out that the ojdbc14.jar was issued with 10gR2...

                           

                          and the following url syntaxes:

                          jdbc:oracle:thin:@[HOST][:PORT]:SID

                          jdbc:oracle:thin:@[HOST][:PORT]/SERVICE

                          jdbc:oracle:thin:@//[HOST][:PORT]/SERVIC

                           

                          Even if in the listener.ora I add SE_SID_AS_SERVICE_LISTENER=ON to force the use of a SID, it still does not work...

                           

                          I do not get any error anymore in the Tomcat server log, but I get no result when testing the connection from the application, and as a consequence no report can be generated (at least I get an empty page).

                           

                          It seems the problem is on another level.

                          Any other suggestions/ideas maybe?

                           

                          Kind Regards

                          • 12. Re: HTTP Status 404 and unable to get database connection
                            Laury

                            Hi,

                            I was unable to sove this issue.

                            Although the above formats for a jdbc connection and for a PDB are correct (I know it works fine like this with SQL Developer).

                            The only work-around I has was to "go back" to a non=PDB database (it works with Oracle RDBMS 12c).

                            Kind Regards