Win a copy of Head First Android this week in the Android forum!

Yogesh Gandhi

Ranch Hand
+ Follow
since Dec 05, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Yogesh Gandhi

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

Please check the attachment for code and the result.
1 month ago

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 (inside the jar) to some package.
Just that it doesnt likes default package.

Can someone please help me with the basics of this.

4 months ago

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?

8 months 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?
9 months 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
9 months 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.
9 months ago
I found out a work around to access the variable in the scriptlet. Though not as elegant way of doing it, but still it solves the problem

In this above example, the reqirement was to access the abc variable in the scriptlet

And then get that from request.getAttribute("abc")

10 months ago

Joe Ess wrote:I'm saying the variable will be in the Value Stack.  It's an integral part of Struts 2.  see here
My personal opinion is that scriptlets are awful and one should avoid them at all costs.  It would also be wise to sit down and learn how to use Struts 2 effectively.  By taking the half-and-half route, you are missing out on the benefits of using Struts 2 while also causing more problems for yourself by trying to write code to get around the framework.

I understand what you are saying, but the problem I have in hand is, that code is an already running application, which has tons of JSPs and it is already using scriptlets and variables as shown in my first post.

Now I do not want to mess up the things any further. At present the job I have in hand is, to make it compatible with Struts2.
10 months ago

Joe Ess wrote:The "var" attribute is the name of the iterator on the Value Stack (see here).  The tag is not creating a variable with that name.

Thanks for your response. But I need that as a variable as well (as it was being used in struts1). So that I can go ahead with minimal changes in the JSP.

Are you saying that its not possible?
10 months ago

Joe Ess wrote:Did you try it?  My wild guess would be that it would not work.  The two versions of Struts are very different code bases, including the JSP tag libraries.

Well I didnt' try exactly this, but other way round I tried.

Struts 1 Action class
Struts 2 JSP

And it works...But at this moment I am facing another problem.

I am setting attribute in ACtion class into request, which I am not able to display on the JSP

10 months ago

If I change Action class to struts 2 and keep using struts 1 JSP file?

Is it possible? Will it work?
10 months ago

I have a requirement where I am migrating struts 1 to struts2

Now in the JSP that is already written in struts1, there are scriptlets being used which are accessing the variable defined in <logic:iterator as follows >

I have minimized the code above to the least, so that it is easy to explain the requirement. Though the scriptlet has much bigger code inside it (in actual)

Now the requirement here is to migrate it to struts 2

In struts 2, I do it something as follows

Here I am not able to access the task variable inside scriptlet as I was able to access in struts1.

It is giving compilation error.

I cannot use the struts 2 tags, because such kind of scriptlets are many in the JSP, and I want to go with the least changes so that I dont need to change the complete JSP (whcih ofcourse is error-prone)
10 months ago

Norm Radder wrote:

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;

That error looks like the class file was created by a younger version of java compared with the JVM's version of java

Thanks for taking out your precious time and replying to my post.

Yes, you are right, and this was the exact issue.

Actually I was using commons-lang3-3.11 version which I downloaded from maven repository and it was built using java 1.8
When I found this, I downloaded the lower version of the commons-lang, which was compiled using java version 1.5

Since i was using java version 1.6 on my websphere, putting this new jar solved my problem.
11 months ago
I have one struts 2 web application war file, which is running on my local tomcat.

I checked inside WEB-INF/lib and it has all the required dependencies (for struts 2) -- Jars.jpg attached.

I assume that if my WEB-INF/lib directory contains the required jars, I should not be providing the jars anywhere else.

When I deployed the same war file on websphere, I am getting class not found exception. / No Class found def error.

E0293E: [Servlet Error]-[]: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
       at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(
       at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(
       at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(
       at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(
       at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(

E0293E: [Servlet Error]-[GenericServletWrapper]: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/commons/lang3/StringUtils, offset=6
       at java.lang.ClassLoader.defineClassImpl(Native Method)
       at java.lang.ClassLoader.defineClass(

[12/22/20 4:09:03:657 PST] 00000117 ecs           W scanJAR unable to open input stream for resource org/apache/logging/log4j/Marker.class in archive WEB-INF/lib/log4j-api-2.13.3.jar
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)

Can someone please help me in resolving the errors?

11 months ago