TheTransitClock / transitime

TheTransitClock real-time transit information system
GNU General Public License v3.0
78 stars 30 forks source link

503 error on web #131

Closed yayoyo0 closed 4 years ago

yayoyo0 commented 5 years ago

Hello all.

  1. Cloned repo

  2. mvn package -DskipTestes

  3. java -jar target/transitclockQuickStart.jar

Exceptions in console:

13:25:37.343 WARN thread=Thread-1 [o.e.j.s.h.C.api:2355] unavailable java.lang.ClassCastException: org.glassfish.jersey.jackson.internal.JacksonAutoDiscoverable cannot be cast to org.glassfish.jersey.internal.spi.AutoDiscoverable at org.glassfish.jersey.model.internal.CommonConfig$2.compare(CommonConfig.java:594) ~[jersey-common-2.11.jar:na]

3:20:35.320 WARN thread=Thread-2 [o.h.e.j.s.SqlExceptionHelper:144] SQL Error: -5590, SQLState: 42590

13:20:35.321 ERROR thread=Thread-2 [o.h.e.j.s.SqlExceptionHelper:146] fin de sentencia no esperado

13:20:35.323 ERROR thread=Thread-2 [o.t.g.DbConfig:1056] session test failure: org.hibernate.exception.SQLGrammarException: could not prepare statement {} org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:160) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1885) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1862) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1839) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.doQuery(Loader.java:910) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.doList(Loader.java:2554) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.doList(Loader.java:2540) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.Loader.list(Loader.java:2365) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:353) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1909) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:311) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:141) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.transitclock.gtfs.DbConfig$ValidateSessionThread.run(DbConfig.java:1053) ~[classes/:na] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181] Caused by: java.sql.SQLSyntaxErrorException: fin de sentencia no esperado at org.hsqldb.jdbc.Util.sqlException(Unknown Source) ~[hsqldb-2.2.4.jar:2.2.4] at org.hsqldb.jdbc.Util.sqlException(Unknown Source) ~[hsqldb-2.2.4.jar:2.2.4] at org.hsqldb.jdbc.JDBCPreparedStatement.(Unknown Source) ~[hsqldb-2.2.4.jar:2.2.4] at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source) ~[hsqldb-2.2.4.jar:2.2.4] at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:162) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] ... 16 common frames omitted and finally i cant access web because of this exceptions

scrudden commented 5 years ago

Could you try this on the develop branch and revert?

yayoyo0 commented 5 years ago

Could you try this on the develop branch and revert?

@scrudden develop is my current branch.

Any ideas why this is happening?

scrudden commented 5 years ago

Hi,

Just tried same here and dialog box appeared as expected and no stacktrace to console.

This

mvn package -DskipTestes 

should be

mvn install -DskipTests 

What OS and version of java are you using?

Cheers, Sean.

yayoyo0 commented 5 years ago

Mac OS and java version "1.8.0_181"

vsperez commented 5 years ago

Hi all,

I am taking a look at this issue in a mac, and Sean is right: the command should be mvn install -DskipTests

There is an issue in the hibernate config file for testing: src/main/resources/postgres_hibernate.cfg.xml line 57. This error should only affect the test phase.

There is a changed introduced not long time ago. The property file for running the web and api applications should be parameterized by ${transitclock.configFiles}. Try to run it with java -Dtransitclock.configFiles=PATH_TO_TRANSIT_CLOCK.properties transitclockQuickStart/target/transitclockQuickStart.jar

Please verify there is no typing error and let me know if you have the same or other issue.

Regards Vicente

yayoyo0 commented 5 years ago

Still same issue. im running with: java -jar target/transitclockQuickStart.jar -Dtransitclock.configFiles=transitclock.properties inside transitclockQuickStart

The error on web is the following:

HTTP ERROR 503 Problem accessing /api/v1/key/65562734/agency/01/command/routes. Reason:

Service Unavailable

Powered by Jetty:// 9.4.z-SNAPSHOT

Thanks for all the answers

vsperez commented 5 years ago

Hi,

Can you take a look in the log and see the next line :"Reading from web.xml file the context-param name transitime_config_file_location from the web.xml file to determine the name of the Java properties configuration file." and let us know where is reading the configuration? Processing configuration file: XXXXXXX

Regards Vicente

vsperez commented 5 years ago

Hi again,

I finally could get it running. I will commit as soon as possible the solution for 503 error.

So. First of all, be sure that property file is readable. This can be found in override_web.xml of quickstart resource. Please replace it for:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <display-name>Transitime api</display-name>
    <context-param>
        <param-name>transitime_config_file_location</param-name>
        <!-- Set to customized properties file with db config info and such -->
        <param-value>PATH_TO_PROPERTY_FILE</param-value>
    </context-param>
    <!-- So that configuration parameters can be read in from file -->
    <listener>
        <listener-class>org.transitclock.web.ReadConfigListener</listener-class>
    </listener>
    <!-- For special Http response 416 "Requested Range Not Satisfiable" which 
        is used for when there is no data for a request, use special error page that 
        only returns the message instead of a bunch of ugly html. This way the page 
        that requested the data page via AJAX can read the resulting message and 
        display it without lots of ugly error page html. -->
    <error-page>
        <error-code>416</error-code>
        <location>/error/messageOnlyError.jsp</location>
    </error-page>
    <filter>
        <filter-name>ApiLoggingFilter</filter-name>
        <filter-class>org.transitclock.api.utils.ApiLoggingFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>ApiLoggingFilter</filter-name>
        <url-pattern>/api/*</url-pattern>
    </filter-mapping>
    <!-- Swagger v3 -->
    <servlet>
        <servlet-name>jersey</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.wadl.disableWadl</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <!-- adding 'io.swagger.v3.jaxrs2.integration.resources' is sufficent 
                on it own to register the following paths: /openapi.json : OpenApi spec in 
                json /openapi.yaml : OpenApi spec in yaml /openapi (Accept: : "application/json" 
                : OpenApi spec in json /openapi (Accept: : "application/yaml" : OpenApi spec 
                in yaml -->
            <param-value>
        io.swagger.v3.jaxrs2.integration.resources, org.transitclock.api.rootResources,org.transitclock.api.utils
      </param-value>
        </init-param>
        <init-param>
            <param-name>openApi.configuration.prettyPrint</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>jersey</servlet-name>
        <url-pattern>/doc/*</url-pattern>
    </servlet-mapping>
    <filter>
        <filter-name>ApiOriginFilter</filter-name>
        <filter-class>org.transitclock.servlet.swagger.ApiOriginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>ApiOriginFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

There is a conflict with some libraries. So replace pom content with:

<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <groupId>TheTransitClock</groupId>
    <artifactId>transitclockRunner</artifactId>
    <version>2.0.0-SNAPSHOT</version>
    <name>transitclockRunner</name>
    <url>http://maven.apache.org</url>
    <properties>
        <jettyVersion>9.4.15.v20190215</jettyVersion>
        <!-- <jettyVersion>9.4.0.M0</jettyVersion> -->
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlet</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jsp</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-annotations</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jstl</artifactId>
            <version>${jettyVersion}</version>
        </dependency>
        <!-- <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> 
            <version>1.2</version> </dependency> -->
        <dependency>
            <groupId>TheTransitClock</groupId>
            <artifactId>transitclockCore</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.glassfish.jersey.media</groupId>
                    <artifactId>jersey-media-multipart</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.jersey.media</groupId>
                    <artifactId>jersey-media-json-jackson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.2.4</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/com.jgoodies/jgoodies-forms -->
        <dependency>
            <groupId>com.jgoodies</groupId>
            <artifactId>jgoodies-forms</artifactId>
            <version>1.8.0</version>
        </dependency> <!-- http://mvnrepository.com/artifact/com.miglayout/miglayout-swing -->
        <dependency>
            <groupId>com.miglayout</groupId>
            <artifactId>miglayout-swing</artifactId>
            <version>4.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.46</version>
        </dependency>
        <dependency>
            <groupId>TheTransitClock</groupId>
            <artifactId>transitclockApi</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>TheTransitClock</groupId>
            <artifactId>transitclockWebapp</artifactId>
            <version>2.0.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <id>shade-WelcomePanel</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.transitclock.gui.TransitimeQuickStart</mainClass>
                                </transformer>
                            </transformers>
                            <outputFile>target/transitclockQuickStart.jar</outputFile>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
            <plugin>
                <!-- Build an executable JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>TheTransitClock</groupId>
                                    <artifactId>transitclockApi</artifactId>
                                    <type>war</type>
                                    <version>2.0.0-SNAPSHOT</version>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>../transitclockQuickStart/src/main/resources</outputDirectory>
                                    <destFileName>api.war</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy2</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>TheTransitClock</groupId>
                                    <artifactId>transitclockWebapp</artifactId>
                                    <type>war</type>
                                    <version>2.0.0-SNAPSHOT</version>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>../transitclockQuickStart/src/main/resources</outputDirectory>
                                    <destFileName>web.war</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>TheTransitClock</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>2.0.0-SNAPSHOT</version>
                <configuration>
                    <webAppConfig>
                        <overrideDescriptor>../transitclockQuickStart/src/main/resources/transitime.properties</overrideDescriptor>
                    </webAppConfig>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-dependency-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.10,)
                                        </versionRange>
                                        <goals>
                                            <goal>copy</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Please let me know if that works for you.

I believe I saw an error with the dbname in the webagency table, but that should be other kind of error.

Best regards Vicente

vsperez commented 5 years ago

By the way. I forgot to say. It is the transitclockQuickStart pom and the one above was for testing so the artifactId is incorrect:

<groupId>TheTransitClock</groupId>
<artifactId>transitclockQuickStart</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>transitclockQuickStart</name>
yayoyo0 commented 5 years ago

Hello all. With those changes i couldn't even start the web. I get this error:

java.lang.ClassNotFoundException: org.transitclock.api.utils.ApiLoggingFilter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_181] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_181] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_181] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_181] at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:565) ~[transitclockQuickStart.jar:na] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_181] at org.eclipse.jetty.util.Loader.loadClass(Loader.java:65) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:92) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:93) [transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [transitclockQuickStart.jar:na] at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:749) [transitclockQuickStart.jar:na] at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_181] at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742) ~[na:1.8.0_181] at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742) ~[na:1.8.0_181] at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[na:1.8.0_181] at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:744) [transitclockQuickStart.jar:na] at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:369) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.server.Server.start(Server.java:415) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.server.Server.doStart(Server.java:382) ~[transitclockQuickStart.jar:na] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [transitclockQuickStart.jar:na] at org.transitclock.gui.TransitimeQuickStart.startJetty(TransitimeQuickStart.java:322) ~[transitclockQuickStart.jar:na] at org.transitclock.gui.TransitimeQuickStartThread.run(TransitimeQuickStartThread.java:75) ~[transitclockQuickStart.jar:na] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181]

Thanks in advance

vsperez commented 5 years ago

Hi,

Did you try http://127.0.0.1:8080/api/? It loads in my computer with those changes. I will take a look at the web issue. You should see:

screen shot 2019-03-08 at 14 12 54

yayoyo0 commented 5 years ago

Same issue. I get:

HTTP ERROR 503 Problem accessing /api/. Reason:

Service Unavailable

Powered by Jetty:// 9.4.z-SNAPSHOT

Thanks

vsperez commented 5 years ago

Hi,

There has been a lot of changes, and we have forgotten to update some things in the quickstart app.

So a few more changes:

method public void addWebapp() throws QuickStartException of org.transitclock.gui.TransitimeQuickStart

Please replace webapp.setOverrideDescriptor("override-web.xml"); with webapp.setOverrideDescriptor("override-web-web.xml");

Create the file override-web-web.xml in quickstart resource folder.

Add only this part:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <display-name>Transitime web app</display-name>
    <context-param>
        <param-name>transitime_config_file_location</param-name>
        <!-- Set to customized properties file with db config info and such -->
        <param-value>PATH_TO_PROPERTY_FILE</param-value>
    </context-param>
</web-app>

The exceptions ocurres because it was add swagger support to the API, and that requires some filters. Those filters are not in the WEB app.

Please let me know if finally runs.

Regards Vicente

yayoyo0 commented 5 years ago

Im able to see the web now. Unfortunately i cant change the route. I get:

HTTP ERROR 400 Problem accessing /api/v1/key/65562734/agency/01/command/routesDetails. Reason:

Bad Request

Powered by Jetty:// 9.4.z-SNAPSHOT

Thanks for all the help

yayoyo0 commented 5 years ago

In the API i get the following error.

Failed to load API definition. Errors Hide Fetch errorRequest failed. doc/openapi.json

vsperez commented 5 years ago

Hi,

That's fine. As I said before, there is an issue with the dbname.

In the method 'public void webAgency() throws QuickStartException' of 'org.transitclock.gui.TransitimeQuickStart' please replace the line with ' String dbName = "02";' with 'String dbName = "test";' That should be all. You should see something like:

screen shot 2019-03-08 at 20 26 19

Please let me know if that worked.

Regards Vicente

yayoyo0 commented 5 years ago

Thanks @vsperez. Now the API works but redirects me to the URL: https://github.com/Transitime/core/wiki

Hope you will merge the fixes next week and thanks again for all the help.

vsperez commented 5 years ago

Hi,

Today Sean meged the fox of this issue, @yayoyo0 can you let us know if it is running OK with the new instructions described in the readme file? Do you have any other issues?

Regards Vicente

yayoyo0 commented 5 years ago

Hello Vicente. I still have the 400 error on the following URL: http://127.0.0.1:8080/api/v1/key/65562734/agency/01/command/routesDetails?r=L1

could this be related to the RTfeed?

Thanks a lot

yayoyo0 commented 5 years ago

Also is there any method to run the jar file without GUI?

Thanks again

vsperez commented 5 years ago

Hi,

The " 400 error" is related to the API project and not the quick start. I will take a look at it.

You car run each part separately. Take a look at https://github.com/TheTransitClock/transitime/wiki/Multi-agency-configuration. This is for running more than one agency, but you should be able to run it for only one.

Regards Vicente

yayoyo0 commented 5 years ago

Hi,

The " 400 error" is related to the API project and not the quick start. I will take a look at it. Thanks a lot for that You car run each part separately. Take a look at https://github.com/TheTransitClock/transitime/wiki/Multi-agency-configuration. This is for running more than one agency, but you should be able to run it for only one. Excelent! Regards Vicente

yayoyo0 commented 5 years ago

Hello all. I have pulled the latest changed from develop and i still have the 400 error in the api.

HTTP ERROR 400 Problem accessing /api/v1/key/65562734/agency/01/command/routesDetails. Reason:

Bad Request

Powered by Jetty:// 9.4.z-SNAPSHOT

Thanks in advance

yayoyo0 commented 5 years ago

Also im trying to get the reports and i get this error. No suitable driver found for jdbc:hsql://http://127.0.0.1:8080//test

Thanks.

vsperez commented 5 years ago

Hi,

I haven't downloaded the last merged. Just by curiosity, you called /api/v1/key/65562734/agency/01/command/routesDetails with the r parameter, didn't you?. I will check it as soon as possible.

Regards Vicente

yayoyo0 commented 5 years ago

Hello Vicente. Indeed the r parameter was added to the request.

Thanks in advance

yayoyo0 commented 5 years ago

Also i have one question.

When the static GTFS where added the only agency that is shown is the first one in the GTFS. Is that something with the config or is it something with the GTFS?

Thanks

vsperez commented 5 years ago

Hi,

Actually, if you have more than one agency, you should use two instances of the core. As far as I know TheTransitClock is intended to run one core per agency. If you follow the instructions of multi-agency configuration, you should get two core running plus one web showing more than two agencies and one api.

Regards Vicente

yayoyo0 commented 5 years ago

Hi,

Actually, if you have more than one agency, you should use two instances of the core. As far as I know TheTransitClock is intended to run one core per agency. If you follow the instructions of multi-agency configuration, you should get two core running plus one web showing more than two agencies and one api.

Regards Vicente

I have run all the steps but the last one. Do i need to repackage the war file in order to run it on tomcat?

Best regards.

vsperez commented 5 years ago

Hi,

No. It will run perfectly well on tomcat. Just remember to add to the java parameters (-D) "transitclock.apikey" and "transitclock.configFiles properites" parameters.

Probably you will get the same error on routeDetail call of the api. I have been a little bit busy, but probably this evening I will take a look.

Regards Vicente

yayoyo0 commented 5 years ago

Thanks a lot Vicente.

In case i dont want to use Tomcat is that possible?

Best regards. Luis

vsperez commented 5 years ago

Hi Luis,

The api and Web app are intended to run on some application server like jetty or tomcat. It is built using Jersey (in which I am not very familiar) and jsp. I believe to run the api with other frameworks, such as spring boot, is possible, but I don't know how many changes in the should be done.

By the way, I found the issue with the api. I will let you know when it be done.

Regards Vicente

yayoyo0 commented 5 years ago

Hi Luis,

The api and Web app are intended to run on some application server like jetty or tomcat. It is built using Jersey (in which I am not very familiar) and jsp. I believe to run the api with other frameworks, such as spring boot, is possible, but I don't know how many changes in the should be done.

By the way, I found the issue with the api. I will let you know when it be done.

Regards Vicente

AWESOME! My intention is to run it in console like Open Trip Planner, is that possible?

Thanks a lot

vsperez commented 5 years ago

Hi,

Yes it is... You just need to modify a little bit the quick start.

Regards Vicente

El sáb., 16 de mar. de 2019 14:49, Luis Eduardo notifications@github.com escribió:

Hi Luis,

The api and Web app are intended to run on some application server like jetty or tomcat. It is built using Jersey (in which I am not very familiar) and jsp. I believe to run the api with other frameworks, such as spring boot, is possible, but I don't know how many changes in the should be done.

By the way, I found the issue with the api. I will let you know when it be done.

Regards Vicente

AWESOME! My intention is to run it in console like Open Trip Planner, is that possible?

Thanks a lot

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheTransitClock/transitime/issues/131#issuecomment-473569542, or mute the thread https://github.com/notifications/unsubscribe-auth/AmgAGKjz2mOgp3qhSAVTkvqG-jarEArtks5vXS6igaJpZM4bdTgg .

csmarrero commented 5 years ago

Hi,

I have the same problem: HTTP ERROR 400 Problem accessing /api/v1/key/62c0346f/agency/GLOBAL/command/serverStatus Reason: Bad Request Powered by Jetty:// 9.4.z-SNAPSHOT

I follow the instructions on https://github.com/TheTransitClock/transitime/wiki/Multi-agency-configuration. Result: Core works, Web works, Api starts but any call to API method responses 400 - Bad Request

I'm using Jetty9 as application server on debian 9.

What I'm doing wrong? Thanks and best regards,

vsperez commented 5 years ago

Hi,

I believe it is just environment settings.

Did you set transitime_config_file_location param (take a look at the file WEB-INF/web.xml)? In tomcat it is made by set_env.sh adding "-Dtransitclock.configFiles=/path/to/file.properties" to the VM params( I don't know about Jetty, but should be pretty similar). Other thing that might be is the property "transitclock.hibernate.configFile" of the property file, try to use absolute path.

When you type in the browser http://{server}:{port}/api, do you get a web page? If that's the case, go to documentation and try the "agency call" the api. This is the simplest request and it should return the agency configuration.

Regards Vicente

csmarrero commented 5 years ago

Hi,

I think so, must be environment settings, but I don't find where it is. When I go to http://{server}:{port}/api, I see this image

And in swagger, the only method that response 200 is this /api/v1/key/62c0346f/command/agencies Captura de pantalla 2019-06-12 a las 0 01 22

This is the content of config.xml

< transitime>
    <db>
        <dbName>transit</dbName>
        <dbHost>localhost:3306</dbHost>
        <dbType>mysql</dbType>
        <dbUserName>dbuser</dbUserName>
        <dbPassword>dbpass</dbPassword>
    </db>
    <hibernate>
        <configFile>hibernate.cfg.xml</configFile>
    </hibernate>
</transitime>

Any idea?

Thanks, Carmelo.

vsperez commented 5 years ago

Hi,

I see that API is working, but no agancy is found. So it might be hibernate configFile. Try with absolute path. The api communicates with the core using RMI, the core is running in the same machine, isn't it?. Can you send me the webagancy register from the database?

Regards Vicente

El mié., 12 de jun. de 2019 04:57, csmarrero notifications@github.com escribió:

Hi,

I think so, must be environment settings, but I don't find where it is. When I go to http://{server}:{port}/api, I see this [image: image] https://user-images.githubusercontent.com/2453370/59312411-f685cd80-8ca4-11e9-934e-cf9a2a8251d7.png

And in swagger, the only method that response 200 is this /api/v1/key/62c0346f/command/agencies [image: Captura de pantalla 2019-06-12 a las 0 01 22] https://user-images.githubusercontent.com/2453370/59312537-6e53f800-8ca5-11e9-8bfe-cb1c8a4f35d0.png

This is the content of config.xml

< transitime>

transit localhost:3306 mysql dbuser dbpass hibernate.cfg.xml Any idea? Thanks, Carmelo. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
csmarrero commented 5 years ago

Hi, I see that API is working, but no agancy is found. So it might be hibernate configFile. Try with absolute path.

I put absolute path o config files and same result. But I see on jetty logs that {transitclock.configFiles} is not set. I try to put the absolute path and same result.

The api communicates with the core using RMI, the core is running in the same machine, isn't it?. Can you send me the webagancy register from the database?

Yes the core is in the same machine. This is the record from database.

agencyId active dbEncryptedPassword dbHost dbName dbType dbUserName hostName GLOBAL 1 fGTF7L1NK1qv7O45Hpdwjyj6olm43qKX localhost:3306 transit mysql root localhost

Regards Carmelo.

scrudden commented 5 years ago

This might not be it but just in case, the "< transitime>" tag in the config.xml above has a space in it and it should not.

vsperez commented 5 years ago

Hi,

Sean is right, it might be that.

If transitclock.configFiles is not set, the API won't find the configuration file unless you put it directly in WEB-INF/web.xml. It should be set if you run JVM with -Dvarname=varvalue. If not, try to replace the value in web.xml with the absolute path to the configuration file.

The webagancy looks fine.

Let me know if that works.

Regards Vicente

El mié., 12 de jun. de 2019 07:16, Sean Óg Crudden notifications@github.com escribió:

This might not be it but just in case, the "< transitime>" tag in the config.xml above has a space in it and it should not.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheTransitClock/transitime/issues/131?email_source=notifications&email_token=AJUAAGF2DFPWQCFU6J5KPQLP2DLHXA5CNFSM4G3VHAQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXQCJWY#issuecomment-501228763, or mute the thread https://github.com/notifications/unsubscribe-auth/AJUAAGDS37E3RIUVAJCS3ITP2DLHXANCNFSM4G3VHAQA .

scrudden commented 5 years ago

Also, should the tag be transitclock or transitime?

csmarrero commented 5 years ago

Hi Sean, Hi Vicente,

I replace the value in web.xml with the absolute path. But it does not works. It charges the configuration xml, and hibernate configuration (I set true to show_sql). Check that every service is up and running on its port:

root@fv-transit:/usr/share/jetty9# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      571/java            
tcp        0      0 0.0.0.0:2098            0.0.0.0:*               LISTEN      859/java            
tcp        0      0 0.0.0.0:2099            0.0.0.0:*               LISTEN      859/java            
tcp        0      0 0.0.0.0:20000           0.0.0.0:*               LISTEN      590/sshd            
tcp6       0      0 :::3306                 :::*                    LISTEN      720/mysqld    

I activate Jetty9 console log, and every minute writes that

Jun 12 13:44:01 fv-transit jetty9[571]: Hibernate:
Jun 12 13:44:01 fv-transit jetty9[571]:     /*
Jun 12 13:44:01 fv-transit jetty9[571]: FROM
Jun 12 13:44:01 fv-transit jetty9[571]:     WebAgency */ select
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.agencyId as agencyId1_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.active as active2_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.dbEncryptedPassword as dbEncryp3_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.dbHost as dbHost4_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.dbName as dbName5_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.dbType as dbType6_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.dbUserName as dbUserNa7_37_,
Jun 12 13:44:01 fv-transit jetty9[571]:         webagency0_.hostName as hostName8_37_
Jun 12 13:44:01 fv-transit jetty9[571]:     from
Jun 12 13:44:01 fv-transit jetty9[571]:         WebAgencies webagency0_

Next step, uninstall jetty9 and use Tomcat

vsperez commented 5 years ago

Hi,

Just one last check before going into tomcat, is there any error on the transiclock log files?

By the way, what version of MySQL are you using? I found an issue using drivers of mysql 5 against mysql 8 (authentication libraries). I don't think that's the case, but it might be worth to verify.

Regards Vicente

El mié., 12 de jun. de 2019 08:56, csmarrero notifications@github.com escribió:

Hi Sean, Hi Vicente,

I replace the value in web.xml with the absolute path. But it does not works. It charges the configuration xml, and hibernate configuration (I set true to show_sql). Check that every service is up and running on its port:

root@fv-transit:/usr/share/jetty9# netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0: LISTEN 571/java tcp 0 0 0.0.0.0:2098 0.0.0.0: LISTEN 859/java tcp 0 0 0.0.0.0:2099 0.0.0.0: LISTEN 859/java tcp 0 0 0.0.0.0:20000 0.0.0.0: LISTEN 590/sshd tcp6 0 0 :::3306 :::* LISTEN 720/mysqld

I activate Jetty9 console log, and every minute writes that

Jun 12 13:44:01 fv-transit jetty9[571]: Hibernate: Jun 12 13:44:01 fv-transit jetty9[571]: / Jun 12 13:44:01 fv-transit jetty9[571]: FROM Jun 12 13:44:01 fv-transit jetty9[571]: WebAgency / select Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.agencyId as agencyId137, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.active as active237, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.dbEncryptedPassword as dbEncryp337, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.dbHost as dbHost437, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.dbName as dbName537, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.dbType as dbType637, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.dbUserName as dbUserNa737, Jun 12 13:44:01 fv-transit jetty9[571]: webagency0_.hostName as hostName837 Jun 12 13:44:01 fv-transit jetty9[571]: from Jun 12 13:44:01 fv-transit jetty9[571]: WebAgencies webagency0_

Next step, uninstall jetty9 and use Tomcat

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheTransitClock/transitime/issues/131?email_source=notifications&email_token=AJUAAGDRTCL7P3X7HRJKDJ3P2DW7JA5CNFSM4G3VHAQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXQKCDY#issuecomment-501260559, or mute the thread https://github.com/notifications/unsubscribe-auth/AJUAAGFLDACZJXWIYK7SM5LP2DW7JANCNFSM4G3VHAQA .

csmarrero commented 5 years ago

Hi again Sean, Vicente,

In the same server. I install Tomcat9, deployed api.war and web.war

create setenv.sh file with export CATALINA_OPTS="$CATALINA_OPTS -Dtransitclock.configFiles=/usr/local/tomcat9/transitclockConfig.xml

restart tomcat9 and, web works but api still returns 400-Bad Request

This is the content of transitclockConfig.xml

<transitime>
    <logging>
        <dir>logs</dir>
    </logging>
    <core>
        <agencyId>GLOBAL</agencyId>
    </core>
    <db>
        <dbName>transit</dbName>
        <dbHost>localhost:3306</dbHost>
        <dbType>mysql</dbType>
        <dbUserName>user</dbUserName>
        <dbPassword>pass</dbPassword>
    </db>
    <hibernate>
        <configFile>/usr/local/tomcat9/hibernate.cfg.xml</configFile>
    </hibernate>
</transitime>

and this is the hibernate.cfg.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM 
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
 <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

     <property name="show_sql">true</property>
     <property name="format_sql">true</property>
     <property name="use_sql_comments">true</property>

     <property name="hibernate.jdbc.batch_size">1</property>
     <property name="default_batch_fetch_size">25</property>
     <property name="hibernate.order_inserts">true</property>
     <property name="hibernate.order_updates">true</property>
     <property name="hibernate.connection.autocommit">true</property>
     <property name="hibernate.hbm2ddl.auto">update</property>

     <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
     <property name="connection.url">jdbc:mysql://localhost:3306/transit</property>
     <property name="connection.username">user</property>
     <property name="connection.password">pass</property>

     <mapping resource="named_queries.hbm.xml" />
  </session-factory>
</hibernate-configuration>

Any idea?

Thanks and regards, Carmelo.

csmarrero commented 5 years ago

Hi,

Just one last check before going into tomcat, is there any error on the transiclock log files?

Yes it is. this one:

ava.lang.NullPointerException
        at org.transitclock.core.holdingmethod.HoldingTimeGeneratorDefaultImpl.getControlPointStops(HoldingTimeGeneratorDefaultImpl.java:609)
        at org.transitclock.core.holdingmethod.HoldingTimeGeneratorDefaultImpl.isControlStop(HoldingTimeGeneratorDefaultImpl.java:648)
        at org.transitclock.core.holdingmethod.HoldingTimeGeneratorDefaultImpl.handleDeparture(HoldingTimeGeneratorDefaultImpl.java:713)
        at org.transitclock.core.ArrivalDepartureGeneratorDefaultImpl.updateCache(ArrivalDepartureGeneratorDefaultImpl.java:377)
        at org.transitclock.core.ArrivalDepartureGeneratorDefaultImpl.createDepartureTime(ArrivalDepartureGeneratorDefaultImpl.java:297)
        at org.transitclock.core.ArrivalDepartureGeneratorDefaultImpl.handleVehicleDepartingStop(ArrivalDepartureGeneratorDefaultImpl.java:882)
        at org.transitclock.core.ArrivalDepartureGeneratorDefaultImpl.generate(ArrivalDepartureGeneratorDefaultImpl.java:1304)
        at org.transitclock.core.MatchProcessor.processArrivalDepartures(MatchProcessor.java:143)
        at org.transitclock.core.MatchProcessor.generateResultsOfMatch(MatchProcessor.java:204)
        at org.transitclock.core.AvlProcessor.lowLevelProcessAvlReport(AvlProcessor.java:1425)
        at org.transitclock.core.AvlProcessor.processAvlReport(AvlProcessor.java:1619)
        at org.transitclock.avl.AvlClient.run(AvlClient.java:163)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
        at org.transitclock.utils.threading.NamedThread.run(NamedThread.java:100)

By the way, what version of MySQL are you using?

mysql 5.7

Also, should the tag be transitclock or transitime?

I change transitime for transitclock, and same result.

Also, transitclock.configFiles and transitclock.apikey are set in tomcat,

By the way, I try to get api method /api/v1/key/62c0346/agency/GLOBAL/command/agencyGroup with a invalid apikey and get this. (the correct apikey is 62c0346f)

Captura de pantalla 2019-06-12 a las 16 49 07

So it seems that api is connected to database.

Do I set all the necessary params to start and connect to core? How Can I check if api is connected to rmi server?

Thanks and best regards, Carmelo.

scrudden commented 5 years ago

Can you see an avl.log file and is it being updated regularly? This should tell us if core is running.

csmarrero commented 5 years ago

Can you see an avl.log file and is it being updated regularly? This should tell us if core is running.

Yes, the core is working and logging

Captura de pantalla 2019-06-12 a las 17 26 39

csmarrero commented 5 years ago

Hi,

Maybe this can be useful, I try to get information using the application RmiQuery.jar and get this response.

Captura de pantalla 2019-06-12 a las 17 34 45

It looks like the core is not answering via rmi. Am I wrong?

But if you looks for open ports, Captura de pantalla 2019-06-12 a las 17 42 26

Rmi ports (2099, 2098) are up.

Regards, Carmelo

scrudden commented 5 years ago

Can you try the same but use the command -c "resetVehicle". It should throw an exception if it cannot connect to the RMI server.