Weblogic 12c ear deployment - jstl

I have a bunch of war files running on a Tomcat server. I packaged these files into an ear and I want to deploy it on Weblogic 12c Server. It seems that Weblogic try to precompile all the jsp contained in the package when i do the deploy. It gives me the following error:
Failure while precompiling JSPs: weblogic.servlet.jsp.CompilationException:xxx.jsp:279:86: This attribute is not recognized.
<fmt:formatDate pattern="dd/MM/yyyy" value="${xxx}" placeholder="${dateformat}"/></td>
^---------^
I guess there is some problem with the jstl libraries. I followed this guide https://docs.oracle.com/cd/E24329_01/web.1211/e21049/configurejsfandjtsl.htm#WBAPP197 and I found out that Weblogic version i'm using should support Jstl natively.

The <fmt:formatDate> tag is invalid. There is no placeholder in the tag. The placeholder attribute should be in the input tag instead. Your page should read something like this:
<fmt:formatDate pattern="dd/MM/yyyy" value="${xxx}" var="formattedDate" />
<input placeholder="${formattedDate}"/>
Nothing wrong with the JSTL libraries, rather a problem with your code. You probably didn't see this under Tomcat because you don't precompile the files there and haven't navigated to the page in question.

Related

url after spring maven deployment

I have a basic question about deployment but I can't seem to find an answer on google...
I am working on a jakarta project and it's the first time I do the deployment.
Since I am using Spring-boot maven, I know there is an embedded tomcat that will launch with the jar.
My issue is, I don't know what url to use to check my project is working...
Before, I used the address http://localhost:9091/contextPath/endpoint, but now, I only get a whiteScreen...
So my question is, what url should I use ? Also, is there something else to do after packaging ?
Thank you for your answers.
EDIT:
Alright, so I tried actuator but that didn't help me...
With /actuator/mappings, I could see that my endpoints are correctly configured but when I use the executable jar, http://localhost:9091/contextPath/endpoint odes not work while it does if I compile with my IDE...
I don't know what url to connect to just to see the index... I'm using a very basic spring framework (boot and mvc) and my IDE is intellij community if this helps anyone
EDIT 2:
I tried to deploy the app on a local Tomcat9 to see if something would change but the connexion is reinitialized everytime I try to deploy a war using the manager, and there was no trace of error in the logs.
I tried using ./mvnw and it did work, endpoint and all, but it implies working with IDE environment
I tried using java (openjdk 13) and it compiled, but i couldn"t acces my own endpoint. I could still access the actuator endpoints so i don't know what to make of it.
Should the url be different depending on whether we are using IDE environment or just the jar?
EDIT 3:
Ok, I think have a lead but I have no idea how to resolve this:
when I began the web part of the application, I created a WEB-INF folder where I put all my jsp. My js and css files were in the resources/static folder. I tried once to put the jsp in the resources folder but it didn't work so I didn't push too hard.
Now, when I unzip the jar, i find my css and js files, but not my jsp.
When I unzip my war file, I have everything, but when I try to deploy it on a separate tomcat server, the connexion resets and I don't know why because nothing is written in the logs.
The issue then becomes:
Right now, I have
└──src
└──main
├──java
├──resources
| ├──static
| | ├──css
| | └──js
| └──template
└──webapp
└──WEB-INF
└──classes
└──jsp
What is the standard tree in intellij with jsp ?
By default Spring Boot apps are on port 8080.
Can you try http://localhost:8080?
Port can be changed in application.properties (or application.yml, application-profile.properties etc.) via server.port property (e.g. server.port=8888).
Ok, I managed to make it work.
I'm going to describe here everything of note that I encountered.
First, when I called my app to the usual url, there was no response (whiteLabel).
I added test logs and i found that I indeed called m controller.
I unzipped the jar and war i produced and came to the conclusion that the issue was architectural. I couldn't use jar, I had to use the war file.
I tried to deploy on a local tomcat server using the manager, but it always resetted the connection, so I took the manual approach - copy pasting the war file in the webapp directory.
Finally, the web pages were accessible in the browser.
Thank you for all the tips given during my research!
`http://endpoint:{PORT}/actuator/health` or `http://endpoint:{PORT}/actuator/status`
it should help but it must require spring-boot-actuator as a dependency in your pom/gradle file.

How to use JSTL 1.2 on Tomcat 8?

I want to use JSTL 1.2 in my Tomcat 8 web app. I continue to get JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application. None of the other answers on the internet solve this problem for me.
I have verified that the jstl-1.2.jar is in my web app's WEB-INF/lib folder and my JSP has the newer, <%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> declared at the top.
If I open the jstl-1.2.jar file with 7zip, I can clearly see the c.tld file inside the META-INF folder and within that file I can even see this line: <uri>http://java.sun.com/jsp/jstl/core</uri>.
I am not using maven, just copying jars into the WEB-INF/lib folder as needed.
My web-app's web.xml file specifies it is web-app version 3.1
What else can I do to troubleshoot this? Also, is there any modern documentation on using JSTL? Oracle's docs end up here, which has almost no details on using JSTL, or even how to get it.
Webapp structure:
In my case, Tomcat's catalina.properties file had the jarsToSkip setting at \*.jar, so no jars would be scanned, resulting in quicker startup. To override this, I added taglibs*.jar (my jars were called taglibs-standard-impl-1.2.5.jar and taglibs-standard-spec-1.2.5, so it picked both up) to the jarsToScan setting below it, which fixed the problem.
I'm guessing that if jars aren't scanned, taglibs can't be found.
Tomcat's page has a nice write up of using taglibs here with a helpful readme.

GET request on my form and UTF-8

I have a problem with GET request on my form and UTF-8.
UTF-8 and arabic character work fine in my web application developed by spring mvc + hibernate except with Get request in my form (post request work fine)
<form:form method="get" .... >
in controller i got character like this ÙÙسÙ
I read that i have to put URIEncoding="UTF-8" on <Connector> in server.xml i try it when i deploy my project and it's work but with eclipse i can't found this file because i'm in developing level, even when i add this line in server.xml in tomcat directory but tomcat in eclipse seems not be affected with these changes even if i change the http port !
The problem is solved i was editing the wrong file, actually in eclipse the file server.xml can be found in Servers section in Projects explorer
Because eclipse use a tomcat instance not the original tomcat.
So you have to add URIEncoding="UTF-8" on <Connector> in server.xml and the get request work fine with arabic character.

Clear web pages cache in jboss

I develop a web app:
frontend javascript
transport json
backend Java EE
JBoss AS 6.1
All static html and js files are in an exploded .war directory which itself is in an exploded .ear directory.
Normally everything works fine! Today I changed a html file and copied it to the .war directory.
When the browser loaded the file it was the old one. So I started wireshark and saw in wireshark the get request and the returned OLD file, even when I changed the filename in the .war directory.
So there is some caching in jboss. I started Googling and found some posts about the tmp and work folders.
I looked in my "...\server\default\work..." folders, but everything was empty.
In "...\server\default\tmp" I found some files but no one seems to be related to my cached page.
As this is a tomcat-in-jboss issue, you have to go to the tomcat area in jboss.
In my case ..\server\default\deploy\jbossweb.sar. In this directory you should find a file called context.xml.
Now stop jboss.
In the context tag there are 2 attributes - cookies and crossContext. Now just add the attribute cachingAllowed="false" and start jboss again:
<Context cookies="true" crossContext="true" cachingAllowed="false">
If you need only one time solution, just create fresh ear with fixed HTML file, undeploy the old one and deploy the new one.

Using FreeMarker with Apache Sling

I'm using a Content Repository (Adobe CQ5) that has Apache Sling underneath. I'd like to render web pages using FreeMarker instead of JSP.
For that to work should I upload the OSGi Freemarker extension to Sling, which is to be found in the contribution part of Sling source code, or should I upload an OSGi version of Freemarker instead? Both jars implement the interface javax.script.ScriptEngineFactory so I don't know which one to use, or to upload both.
I managed to get Freemarker working on CQ5.3 by doing the following:
get the source from svn checkout http://svn.apache.org/repos/asf/sling/trunk sling
go to the contrib/scripting/freemarker and remove all the logging and slf4j references from FreemarkerScriptEngine.java - it throws a 500 error due to NoClassDefFoundException - I think there is a conflict between CQ5 and a version of slf4j included in Freemarker (I didn't dig to find out what was wrong)
build it and install, it should appear in the Sling console under bundles and in the 'script engines' page, and let you use .ftl scripts now.
I did it slightly differently by creating the bundle inside CQ5, importing the code and adding a stock freemarker.jar into the bundle but this should work too as it's basically the same thing.
The problem I had was that the script engine does get listed but the logging prevents it from running, that's why you need to remove the log & slf4j from the engine.
I don't know about the OSGi version of Freemarker; we created our own bundling of Freemarker specially for Sling. If you have success using the OSGi version of Freemarker let us know ;-)
Testing is easy: Just install the bundle through the Web Console and check for the supported Script Engines in the Web Console Configuration Status. If you see the Freemarker Engine listed there, it should work.

Resources