Posts by Marquezani • 662 points
31 posts
-
0
votes2
answers676
viewsA: How to convert from hexadecimal to Base64?
From to use the library Guava byte[] bytes = BaseEncoding.base64().decode(hex); String base64 = BaseEncoding.base64().encode(bytes);…
-
0
votes1
answer178
viewsA: Socket Error in get https request
HTTPS connections need "Handshake" for the communication to work properly, for this the server uses an HTTPS certificate that must be used by the client to make the connection, in this scenario…
-
2
votes1
answer293
viewsA: Datasource Postgresql Widlfly
The problem is because Wildfly already has the Hibernate libs on the server itself in different versions than the application’s classpath. By marking lib as provided in Maven you define that you…
-
2
votes1
answer794
viewsA: Hibernate does not find mysql JDBC "Driver" class in Maven project
As you are climbing your application on a Tomcat server common libraries should be configured in the folder /lib server as is the case with mysql. Add the jar to the folder /lib Tomcat To find the…
-
1
votes1
answer219
viewsA: Insertion of float value into a Jsonobject
One way would be to convert your float to String by formatting the decimals and using the constructor Jsonobject(String) to pass the value Following example: float v = item.getValor(); JSONObject…
-
10
votes4
answers865
viewsA: How to separate a string when the string does not have a separator?
Use split with regular expression looking for any character. Follow example below String texto = "1234"; String split[] = texto.split("(?!^)"); Upshot split ["1", "2", "3", "4"]…
javaanswered Marquezani 662 -
0
votes1
answer3654
viewsQ: Find duplicate values in an Oracle table
Have a table in an Oracle database called MESSAGE. This table has some fields among them LOCALID and APPLICATIONNAME. Below are examples of values entered in the database LOCALID - APPLICATIONNAME 1…
-
0
votes1
answer158
viewsA: Error when trying to edit a record: component<p:selectManyCheckbox/> failed to lazily initialize a Collection of role:
The problem is because you are trying to open a Hibernate session from the presentation layer Add Fetchtype.EAGER to Hibernate to carry the information for you @ManyToMany(fetch = FetchType.EAGER,…
-
0
votes1
answer101
viewsA: How do I redirect Exception to an error page?
Add the property Authentication-Failure-url to your spring-security configuration xml Example: <form-login login-page="/" login-processing-url="/login" username-parameter="username"…
-
0
votes1
answer732
viewsA: Memory reserved for Tomcat
The Memory Heap used by Tomcat is defined by the parameter jvm -Xmx. Check if the environment variable exists CATALINA_OPTS=-Xms64m -Xmx256m Check if the above variable is used by the following…
-
0
votes2
answers215
viewsA: getParameter returning the same value
The method getParameter() return only the first element found. In your case as is a list of elements the ideal is to use the method getParameterValues() //o metodo retorna um array de Strings…
-
0
votes1
answer277
viewsA: Widfly 9.0.2 is not initializing in debug mode
The wildfly has a standard timeout of 300ms. Try increasing the jboss timeout by adding the option "blocking.". For this change the file bin/standalone.conf.bat (location may vary depending on your…
-
0
votes2
answers124
viewsA: Java: Copy file with 0 bytes
Try using the byteBuffer class as below FileChannel sourceChannel = null; FileChannel destinationChannel = null; try { sourceChannel = new FileInputStream(source).getChannel(); destinationChannel =…
javaanswered Marquezani 662 -
3
votes1
answer92
viewsA: Python - Qdate to datetime conversion
The Qdatetime has a function toPyDateTime that returns an object datetime pattern from PyQt5.QtCore import QDate, QDateTime #usando Date QDate.currentDate().toPyDate() datetime.date(2017, 3, 17)…
-
2
votes1
answer1067
viewsA: how to make a controller for the index page with Spring Boot
Add redirect to configuration class @Configuration public class MyWebMvcConfig { @Bean public WebMvcConfigurerAdapter forwardToIndex() { return new WebMvcConfigurerAdapter() { @Override public void…
-
1
votes1
answer312
viewsA: Show sql generated by JPA/Hibernate
You can enable and disable the SQL log using the code below Logger sqlLogger = Logger.getLogger("org.hibernate.SQL"); sqlLogger.setLevel(Level.DEBUG); ... código ... sqlLogger.setLevel(Level.OFF);…
-
0
votes1
answer202
viewsA: Use of hashmap to make comparisons
If you compare two objects as above, what will be compared is the location of the same in memory and in this case will only be the same object if they point to the same position in memory. To solve…
-
5
votes1
answer151
viewsA: What would MOJO be on Maven?
MAven Plain TheLd JAva Thebject Each MOJO is an executable Goal of Maven and a plugin is a distribution of one or more Mojos. That is, MOJO is a Maven Goal to extend features not yet existing in…
mavenanswered Marquezani 662 -
3
votes1
answer48
viewsA: Considering a BD that is based on ODBC, what is the function of the JDBC in this case?
ODBC is an interface that does not depend on a specific programming language, database or operating system. It can be used to write applications that search for data from any database, regardless of…
javaanswered Marquezani 662 -
1
votes2
answers187
viewsA: javax.servlet.Servletexception: java.lang.Exceptionininitializererro
Add the following parameter to your persistence.xml <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/> This will force Hibernate to use Ehcache…
-
0
votes1
answer1279
viewsA: Sqlexception: ORA-00257: Archiver error. Connect Internal only, until Freed
The problem was really oracle ARCHIVE space which was full. And according to the DBA when that space is too full Oracle starts to reject the connections causing error. The ARCHIVES was cleaned and…
-
1
votes1
answer1279
viewsQ: Sqlexception: ORA-00257: Archiver error. Connect Internal only, until Freed
Have an Oracle database connection that makes a simple entry into the database. The process was working, but now this presenting the error below. 2017-07-13 14:25:55.929 ERROR 12062 ---…
-
1
votes2
answers2038
viewsA: Work with JSON for request and Java Sponse
Try this way JSONObject jsonObject = new JSONObject(); jsonObject.put("to", "123456789"); jsonObject.put("msg", "funcionou"); JSONObject json2 = new JSONObject(); json2.put("sendSmsRequest",…
-
0
votes1
answer390
viewsA: Spring + Bootstrap application with problem to locate contextPath and apply CSS
Put classpath: for spring to find resources @Override public void addResourceHandlers(ResourceHandlerRegistry registry) {…
-
3
votes2
answers224
viewsA: Deployer of a Spring Boot Project
Spring boot comes with a built-in Tomcat server ready to run as JAR. For it to work as a WAR the initial class Main must extend the class Springbootservletinitializer. @SpringBootApplication public…
-
2
votes1
answer389
viewsQ: How to find the JVM port in linux?
I have a linux server running a JRE 1.7 and I need to use Visualvm to monitor the performance of applications running on it. Visualvm uses JMX to connect to the linux host but it expects something…
-
0
votes2
answers1178
viewsQ: How to define Enumeration in JSON
I have the following enumeration on XSD for a WSDL <xsd:simpleType name="tipoDocumento"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="INICIAL"/> <xsd:enumeration…
-
0
votes1
answer557
viewsA: Problems with CDI + Weld in Wildfly
Remove these lines from your configuration file (standalone.xml): <extension module="org.jboss.as.jsf"/> And <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>…
-
1
votes1
answer249
viewsQ: What is the best location to provide a property file?
Has a Java project on Spring Boot which connects to the database. Consequently I have an application.yml properties file with the database connection settings. In this file of properties the…
-
0
votes2
answers755
viewsA: Generic DAO with CDI error = cannot be cast to java.lang.reflect.Parameterizedtype
Pass the generic class by parameter in the constructor public Repository(EntityManager manager, Class<T> entityClass) { this.manager = manager; this.clazz = entityClass; }…
-
1
votes1
answer141
viewsA: Spring instantiating object with @Value
Point the location of the properties file to spring use in its class: @Component @PropertySource("classpath:/config.properties}") class TesteClass{ @Value("${algumaCoisa}") String nome String…