Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struts2.5.18 and jquery-plugin 4.0.2 do not work together #165

Open
hkfechner opened this issue Oct 24, 2018 · 29 comments
Open

Struts2.5.18 and jquery-plugin 4.0.2 do not work together #165

hkfechner opened this issue Oct 24, 2018 · 29 comments

Comments

@hkfechner
Copy link

Since struts2.5.18 and jquery-plugin 4.0./4.0.3 (running on tomcat 8.5.34) javascript and jquery-files (contained in struts2-core-2.5.18.jar) can't be loaded.
Until struts2.5.17 and jquery-plugin 4.0./4.0.3 appplication works fine.
As attachmend i will send screenshorts and a ant-based eclipse-project (test.zip).

test.zip
struts2 5 18_jquery-plugin4 0 2
struts2 5 17_jquery-plugin4 0 2

@lukaszlenart
Copy link
Member

Can you post logs from container? And what other plugins do you use (bootstrap)?

@hkfechner
Copy link
Author

hkfechner commented Oct 24, 2018 via email

@hkfechner
Copy link
Author

hkfechner commented Oct 24, 2018 via email

@lukaszlenart
Copy link
Member

GitHub doesn't accept other attachments than images. Please examine the logs, maybe there is an issue with loading classes.

@hkfechner
Copy link
Author

Dear Mr. Lenart

As attachment I send the tomcat- and application-logs (2517..: application runs with strut2-core-2.5.17, 2518..: application runs with strut2-core-2.5.17).
logs.zip

@lukaszlenart
Copy link
Member

Do you use {{devMode=true}}? Please try to disable it and test again. Also clean up Tomcat's temp folder.

@lukaszlenart
Copy link
Member

It is probably related to this issue
https://lists.apache.org/thread.html/3c44da89a32ae0882a07644464c99d52c579fc449d6f67e3a3682f4f@%3Cdev.struts.apache.org%3E

you can post your comments there

@hkfechner
Copy link
Author

hkfechner commented Oct 25, 2018 via email

@lukaszlenart
Copy link
Member

Do you use Maven? If such could you publish result of mvn dependency:tree? If not could you list all the JARs from WEB-INF\lib?

@hkfechner
Copy link
Author

sorry, security constrains of Deutscher Wetterdienst do not accept access to Maven repository outsite DWD. There we can’t use Maven. Therefore I had published an ANT-Project.

logs2018_10_25.zip

@hkfechner
Copy link
Author

Sorry here are the list.
lib_liste.txt

@sdutry
Copy link
Contributor

sdutry commented Oct 25, 2018 via email

@hkfechner
Copy link
Author

hkfechner commented Oct 25, 2018 via email

@sdutry
Copy link
Contributor

sdutry commented Oct 25, 2018

I just did a small test using struts version 2.5.18 and the struts2-jquery-plugin version 4.0.2 and it seems to work.

Can you please post us a demo jsp file in which we can see how the struts2-jquery tags are used and with which attributes? particularly the <sj:head/> tag

@lukaszlenart
Copy link
Member

I think it's a matter of outdated dependencies but our page is also outdated - it targets 2.5.14.1 ;-)

https://struts.apache.org/maven/struts2-core/dependencies.html

Right now I'm working to fix that

@hkfechner
Copy link
Author

hkfechner commented Oct 25, 2018 via email

@sdutry
Copy link
Contributor

sdutry commented Oct 25, 2018

@hkfechner
I'm not seeing the attachments.

can you also please list the jars that are in the WEB-INF/lib folder after deploying to the tomcat?
Just trying to get a full picture.

I'll take a thorough look into this this evening and create a minimal project trying to reproduce your problem.

@hkfechner
Copy link
Author

Sorry!!
Our mailserver blocked this zip-file

Issue165_jsp_struktur.ZIP

@lukaszlenart
Copy link
Member

Ok, the page is up2date now https://struts.apache.org/maven/struts2-core/dependencies.html

I had the same issue but re-building and cleaning up temp folder worked for me, there is a dependency clash but I'm not sure which JARs are the reason.

@hkfechner
Copy link
Author

hkfechner commented Oct 25, 2018 via email

@sdutry
Copy link
Contributor

sdutry commented Oct 25, 2018

@hkfechner
tried to make a project with the exact same library dependencies:
see: https://github.com/sdutry/struts2-jquery-issue165-poc

items of interest:

  • txt file with dependency list (should show the same libraries you mentioned)
  • war inside build folder

i only tried running it with the jetty plugin localy so far, but the jquery files all loaded and i didn't have a problem. (so http on port 80)
Can you try and deploy this war to your tomcat application server and see if you are able to load the jquery files?
( /index.action under the context-root)

@hkfechner
Copy link
Author

I found the problem!

if some constants ar use insite struts.xml application can be failed (depends on constant and value)
examples.:
true is ok, false fails!
true is ok, false fails!

@hkfechner
Copy link
Author

I found the problem!

if some constants are used insite struts.xml, application can be failed (depends on constant and value)
examples:
"struts.devMode": true is ok, false fails
"struts.configuration.xml.reload": true is ok, false fails

@hkfechner
Copy link
Author

I found the problem!

if some constants are used insite struts.xml, application can be failed (depends on constant and value)
examples:
--sorry, correct is:
"struts.devMode": false is ok, true fails
"struts.configuration.xml.reload": false is ok, true fails

@sdutry
Copy link
Contributor

sdutry commented Oct 26, 2018

aha, you're right.

<constant name="struts.devMode" value="true"/>

This lets me reproduce the problem.
I'll look into it this evening to find the exact cause.

Until then i'd suggest putting those values to false.

@sdutry
Copy link
Contributor

sdutry commented Oct 26, 2018

seeing the line number it would suggest that the variable pathPrefixes is null

@sdutry
Copy link
Contributor

sdutry commented Oct 26, 2018

@lukaszlenart

Do you know this by heart?
It seems the DefaultStaticContentLoader is recreated for each request if it's set to struts.devMode=true
therefore the method setHostConfig doesn't get called on the new instance and that means the pathPrefixes variable is null, causing the NPE.
Is this the expected behavior?

Step completed: "thread=main", org.apache.struts2.dispatcher.DefaultStaticContentLoader.setHostConfig(), line=148 bci=42

main[1] print params
com.sun.tools.example.debug.expr.ParseException: Name unknown: params
 params = null
main[1] print packages
 packages = "org.apache.struts2.static template static org.apache.struts2.interceptor.debugging"
main[1] next
>
Step completed: "thread=main", org.apache.struts2.dispatcher.DefaultStaticContentLoader.setHostConfig(), line=149 bci=51

main[1] print pahtPrefixes
com.sun.tools.example.debug.expr.ParseException: Name unknown: pahtPrefixes
 pahtPrefixes = null
main[1] print pahtPrefixes
com.sun.tools.example.debug.expr.ParseException: Name unknown: pahtPrefixes
 pahtPrefixes = null
main[1] print param
 param = null
main[1] print packages
 packages = "org.apache.struts2.static template static org.apache.struts2.interceptor.debugging"
main[1] print pathPrefixes
 pathPrefixes = "[org/apache/struts2/static/, template/, static/, org/apache/struts2/interceptor/debugging/]"
main[1] print this
 this = "org.apache.struts2.dispatcher.DefaultStaticContentLoader@6b2ef50e"
main[1] run
>
Breakpoint hit: "thread=qtp1574503358-29", org.apache.struts2.dispatcher.DefaultStaticContentLoader.findStaticResource(), line=199 bci=7

qtp1574503358-29[1] print pathPrefixes
 pathPrefixes = null
qtp1574503358-29[1] print this
 this = "org.apache.struts2.dispatcher.DefaultStaticContentLoader@1eab2c1a"
qtp1574503358-29[1]

@lukaszlenart
Copy link
Member

lukaszlenart commented Oct 27, 2018

The only idea I have is because of fixed FileManager which properly reloads files now, it is related to this issue
https://issues.apache.org/jira/browse/WW-4948

@lukaszlenart
Copy link
Member

I mean, it properly reloads JARs now, this was somehow broken in previous versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants