Yogesh Gandhi

Ranch Hand
+ Follow
since Dec 05, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
16
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Yogesh Gandhi

Campbell Ritchie wrote:How did you import those types? How did you add the log4j types to the application? Did you use the CLASSPATH?



It was a working maven project. I was able to compile it completely earlier.

When I change the log4j dependencies from 1.x to 2.x, why the heck these classes start giving compilation error.
I am surpised because there are in no way related to the log4j in any way or is it?
2 years ago

Campbell Ritchie wrote:What did the compiler error messages say? Please copy'n'paste the errors rather than posting screenshots.



Session cannot be resolved to a type
InternetAddress cannot be resolved

etc etc
2 years ago
Hi,

I am trying to upgrade my log 4j version from 1.x to 2.x

Earlier log4j entry in pom.xml


Now I am trying to upgrade it to 2.x



But the problem is, I get compilation problems in Some other class (i.e javax.mail or something like that)

But why is that compiler is not able to find these classes after I find log4j version.

Can someone explain me please?

Even i tried to add bridge log4j jars, so that if there is a possibility that these jars are inturn using 1.x log4j, then they may be satisifed, but even that doesnt help.
2 years ago


What will happen if i use stmt.executeUpdate(query2); in the above code?

Will it execute query1, or query2? or will it complain or what will be the behavior.

I learn that we cannot use executeUpdate with parameters on PreparedStatement. It is only meant for Statement object.
But what happens if I do?
2 years ago

Tim Cooke wrote:

Yogesh Gandhi wrote:The issue was with the Java Mail API version that was being used.
When I updated it to latest javax.mail.jar the problem was gone.


For the benefit of future readers of this conversation, what version did you upgrade from and to?



Well, I found 2 solutions for my problem.
1. To update Java Mail API to latest version (1.6) available as of today
2. TO add a line props.setProperty("mail.pop3.ssl.protocols","TLSv1.2") before making connect operation.

2 years ago
The problem got resolved.

The issue was with the Java Mail API version that was being used.
When I updated it to latest javax.mail.jar the problem was gone.
2 years ago

Tim Moores wrote:That's a highly unusual approach to making a JavaMail connection. Based on what information did you write that code?

Update: The host isn't publicly accessible - are you running this code somewhere where it is?



Yes, you are right, this server may not be publicly accessible. It is inside our company premises.
And why is that unusual approach to make a JavaMail connection. Isnt it how I should be doing it?
2 years ago
Hi,

Attached is the code that I am using to connect to mailbox in java



But I am getting the following exception:


javax.mail.MessagingException: Connect failed;
 nested exception is:
       javax.net.ssl.SSLException: Connection reset
       at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
       at javax.mail.Service.connect(Service.java:295)
       at javax.mail.Service.connect(Service.java:176)
       at javax.mail.Service.connect(Service.java:125)
       at TestProgram.main(TestProgram.java:50)
Caused by: javax.net.ssl.SSLException: Connection reset
       at sun.security.ssl.Alert.createSSLException(Alert.java:127)
       at sun.security.ssl.TransportContext.fatal(TransportContext.java:327)
       at sun.security.ssl.TransportContext.fatal(TransportContext.java:270)
       at sun.security.ssl.TransportContext.fatal(TransportContext.java:265)
       at sun.security.ssl.SSLTransport.decode(SSLTransport.java:141)
       at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1198)
       at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1107)
       at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:400)
       at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:372)
       at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:507)
       at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
       at com.sun.mail.pop3.Protocol.<init>(Protocol.java:107)
       at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
       at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
       ... 4 more
       Suppressed: java.net.SocketException: Broken pipe (Write failed)
               at java.net.SocketOutputStream.socketWrite0(Native Method)
               at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
               at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
               at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
               at sun.security.ssl.TransportContext.fatal(TransportContext.java:358)
               ... 16 more
Caused by: java.net.SocketException: Connection reset
       at java.net.SocketInputStream.read(SocketInputStream.java:210)
       at java.net.SocketInputStream.read(SocketInputStream.java:141)
       at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:466)
       at sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:460)
       at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:159)
       at sun.security.ssl.SSLTransport.decode(SSLTransport.java:110)
       ... 13 more

2 years ago
I forgot to close the th:block on line 14 and line 21
2 years ago
I am facing the issue iterating over a list in thymeleaf.

Please check the attachment for code and the result.
2 years ago
HI

I have a main class




This class AbsUserInfoDAO is in a jar file and this class does not have  package.

I am getting compilation error as it is not able to recognize AbsUserInfoDAO class. Why?


If I move my main class also to default package (or without package) I get rid of the error message.

I guess, I will also get rid of the compilation problem if I move the AbsUserInfoDAO.java (inside the jar) to some package.
Just that it doesnt likes default package.

Can someone please help me with the basics of this.

2 years ago
Hi

I have been using javax.mail package to send emails.

I used Transport.send method which throws a MessagingException

Now you see when we send more than 1000 mails, there is a validation at the server side or somewhere, which blocks our IP (if its not properly registered.... may be not a  registered domain or something)
So, after 1000 mails or so, the java program does send mails, but the mails never reach the recepient.

And we never come to know that emails are not going at our end in java program, as the Transport.send doesnt throw exception.

Can someone please guide  me if it is technically possible to track such failures?

2 years ago

Stephan van Hulst wrote:You shouldn't have to. The URL in a WSDL is usually just a default. You can override the default URL when you construct an instance of the client.



So that means changing it to https, doesnt require clients to install some sort of certificates or anything? Just changing the endpoint URL is sufficient?
3 years ago
I am a web service consumer of a soap web service using a soap client.

Now the web service is going to some other url and also its going on https.

Does client needs to be regenerated? Or it needs any other changes except the change of endpoint url?

Note: The service's internal functionality remains the same, (it is only migrating from http to https and on some different server).
Also it might be going on CLOUD, so there might be a need of PROXY (which earlier was not needed as it was hosted on intranet earlier).

Someone kindly throw some light on this, it'll be a great help.

I have posted the same question on stackoverflow also
https://stackoverflow.com/questions/66157041/does-consumer-of-web-service-needs-to-change-if-the-webservice-is-migrated-to-ht
3 years ago

David Nicholls wrote:Hi again,

in this case start your servlet container using these flags.

What is your environment? Are you using eclipse? Using tomcat?

Anyway. You may just as well alter your code:
Just put the following static initializer block in your thread class (or any class that is loaded before calling the service).

static {
System.setProperty("https.proxyHost", "IPgoesHere");
System.setProperty("https.proxyPort", "PortGoesHere");
System.setProperty("http.proxyHost", "IPgoesHere");
System.setProperty("http.proxyPort", "PortGoesHere");
}

I recommend starting the JVM using the -D options. Then you don't have to change your code.



So we are sure on this that if I use -D option I dont need to change my code?

Well in another scenario (Where I had a main program java code)  where I was calling httpURL.openConnection()
I had to use overloaded method httpURL.openConnection(proxy)

and pass a Proxy object in order to make it work. Even though I had it passed as JVM arguments to the main program, this openConnection call still required the proxy object in order to work correctly.
3 years ago