Doubts About Java WS Slowness and Remove warn

Asked

Viewed 66 times

0

1) I have a question about the slowness of a REST web service that I am mounting. In client communication, the server response takes a few seconds. What I’ve already done: -All processes the function does are almost instantaneous, noticeable only by print -Print below demonstrates the timing of the delay, which is: between the WARN and the start of the system execution.

inserir a descrição da imagem aqui

2) Another doubt, is how to correct these displayed Warns

POM.XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>br.com.projeto</groupId>
  <artifactId>Projeto</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Projeto Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <repositories>
    <repository>
        <id>snapshot-repository.java.net</id>
        <name>Java.net Snapshot Repository for Maven</name>
        <url>https://maven.java.net/content/repositories/snapshots/</url>
        <layout>default</layout>
    </repository>  
  </repositories>

  <properties>
    <jersey.version>2.22.1</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 </properties>

  <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>${jersey.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-mvc-jsp</artifactId>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
    </dependency>


    <!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.glassfish.grizzly/grizzly-http-server -->
<dependency>
    <groupId>org.glassfish.grizzly</groupId>
    <artifactId>grizzly-http-server</artifactId>
    <version>2.4.2</version>
</dependency>


    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.1.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>5.1.0.Final</version>
    </dependency>

    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.6</version>
</dependency>


    <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.37</version>
    </dependency>

  </dependencies>
  <build>
    <finalName>Projeto</finalName>
    <plugins>
           <plugin>
               <artifactId>maven-compiler-plugin</artifactId>
               <configuration>
                   <source>1.8</source>
                   <target>1.8</target>
               </configuration>
           </plugin>
       </plugins>    
  </build>
</project>
  • This "Warning", may be the dependency of your "server" that is not solved, could post your "pom.xml" or any other library that uses log4j as logback. This jar that is waiting for this dependency to be solved is from jboss, ta using wildfly, Hibernate, spring? Are some who use logback log4j

  • I added the pom

  • For Warning adds this and to see if it leaves, Hibernate to do Loggin needs this dependency to run slf4j-to-log4j <dependency> <groupid>org.slf4j</groupid> <artifactId>slf4j-api</artifactId> <version>1.5.6</version> </dependency> .

  • Continued to appear

  • Error then and in your Hibernate.properties file it is in your "src folder/" ?

  • I did not find the file in the src/ folder or inside the la folders (like Resources/META-INF, there is only persistence.xml

Show 1 more comment

1 answer

0


How to fix WARN error:

1) I created a lo4j.properties file in src/main/Resources 2) I have added the following code:

#Log to Console as STDOUT
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %3x - %m%n
#Log to file FILE
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=logfile.log
log4j.appender.file.DatePattern='.'yyyy-MM-dd
log4j.appender.file.append=true
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c %3x - %m%n

#Root Logger
log4j.rootLogger=INFO, stdout, file

Source: https://stackoverflow.com/questions/7685510/log4j-warning-while-initializing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.