Tomcat 8 is not scanning apache tiles TLD file inside the jar - spring-mvc

I'm setting up the spring webmvc project using spring boot 2.0.0 version. If i run the application inside the embedded tomcat, it runs fine. I tried deploying it in external standalone tomcat-8 server, it is working fine over there too. But i if package the war and deploy it in the tomcat-8 server configured within eclipse, then it throws below exception.
The absolute uri: http://tiles.apache.org/tags-tiles cannot be
resolved in either web.xml
I included the dependency in the pom file as below.
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.4</version>
</dependency>
I ensured that the tiles-jsp jar is present inside the WEB-INF/lib folder. But still its failing as it is not able to scan the jar for TLD. I tried changing the catalina.properties to include tiles-jsp*.jar. But it is still failing.
Please help me to fix this error.

Does your IDE automatically import dependencies?
Try cleaning your maven dependencies.
Maven clean.
Or try the more brutal command dependency:purge-local-repository.
By the way notice that there's a newer version of your dependency 3.0.8 of 2017. The one that you are trying to use, the 3.0.4, is of 2014.

For me, war file when deployed works perfect. Had an issue where, when I run it under tomcat from inside IDE(Eclipse/STS), it threw error. Maven clean really helped, no other change needed. MAven clean-->build--> restart eclipse/sts tomcat. it works like a charm. Answer by desoss prompted me to perform maven clean. Thanks #desoss.

Related

Not updated module version in Magnolia

What could be a reason for not updated module version in Magnolia 5.7
In Magnolia java project I have submodule with XML descriptor in META-INF/magnolia/mymodule.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module SYSTEM "module.dtd" >
<module>
<name>mymodule</name>
<displayName>mymodule</displayName>
<description>my module</description>
<version>${project.version}</version>
<!-- <version>1.3</version> -->
<dependencies>
<dependency>
<name>core</name>
<version>5.7.4/*</version>
</dependency>
</dependencies>
</module>
When I rebuild the whole project with version changed in project maven pom.xml and deploy on a server I don't see an updated version in Magnolia's Author configuration console. I have to manually remove the old version node in the configuration console (remove JCR node) and then restart the server. After these steps, I can confirm the new version in the configuration console. Which is a pain if you have to deploy to several dev/stage/prod environments needless to say that I have no access to a public instance in a production environment.
The problem with not updated version sounds like not important, but I'm also not seeing new or renamed pages associated with this module. They appear only if I force to reload module by removing version.
One additional detail which may help identify the problem: I can delete version node in JCR, but can NOT delete the whole module node. I receive an error message "Level 1 and 2 nodes in config workspace cannot be unpublished".
What version do you see in the config:/modules/your_module/version before you delete it? Is it lower than version number of version you are trying to install? I would suspect that it's same or higher. Ie you are trying to reinstall same version or downgrade the version. Neither of those is supported hence it doesn't trigger the installation process. Or perhaps you are trying to move up from SNAPSHOT to full version for which there's no install delta either.
As for the warning you get when trying to delete those nodes, it is on purpose. You are not supposed to be deleting those nodes as a normal user since you could cause breakage of dependent (public) instances. Only as admin (via JCR Browser) you are allowed to delete, assuming you know what and why you are doing.

What Drools JARS are needed in a servet's WEB-INF\lib for jBPM?

I have ported a Tomcat servlet to run with JBoss 7.1 and am now trying to add jBPM support to it. I have run the jbpm-5.4.0.Final-installer-full.zip to get JBoss/jBPM installed with Kepler (I had to patch the installer to install Kepler). I then copied a line of code from the installer's "evaluation" sample and placed it in my servlet. That line of code is:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
After adding the necessary imports I got a clean build. I thought that I could then take the Drools run time files I found in the installer's .\runtime\lib and place them in my servlet's .\WEB-INF\lib. However, doing this caused me to get a "Class not found" exception when I tried to execute the KnowledgeBuilder line of code. It turns out that if I replace the JARs from the installer's .\runtime\lib with the JARS in drools-distribution-5.5.0.Final.zip (from http://www.jboss.org/drools/downloads) in my .\WEB-INF\lib I am able to execute KnowledgeBuilder line of code.
My questions are:
1) Why don't the JARs from the installer's .\runtime\lib work in the above?
2) Where can I find documentation on what all of these Drools JARs do and which ones are needed?
Thank you.
Al
If I were to list specific Jars here, the answer would only apply to a specific version of Drools. The best way to get the correct JARs is to use Maven to build your project. That will automatically import all of the JARs that are needed.
You will usually need dependencies for drools-core and drools-compiler. Those have their own transitive dependencies.
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
If you use Eclipse, then you can just create a pom.xml with those dependencies in it. Open it in the Maven pom editor and the "Effective POM" tab will show you all of the required dependencies.

pom.xml no such file or directory

I've got a problem when I am building my project. I uses the springsource tools (STS) version 3.1.0 on Linux platform. After I imported my project to the STS, the springsource tools told me that "No such file or directory" at the pom.xml file. The file is actually exist in the correct path. I think the project is working fine because I've tried to import the same project with the same procedure in the other computer.
When I use console to compile the project with maven, all of them are complied successfully.
I've also tried the following but still not work:
1. reinstall the STS.
2. re-import the project.
3. create a user profile and re-import project.
4. use older version of STS (3.0.0)
I want to import the project to my computer so that I can work with.
Please suggest to resolve the problem. Thanks!
Had "No such file or directory" error on pom.xml in Eclipse Luna SR1.
Tracked it down to be caused by faulty resolution of other projects within the workspace by M2E.
So there are 2 solutions:
Either close the other project in the workspace (a dependency of the project in error).
Or disable workspace resolution by M2E on the project in error (right-click on the project, Maven --> Disable Workspace Resolution).
Obviously, if you need both projects open then option 2. is the way to go. The dependent project then takes the dependency from the local Maven repo, so to refresh it, you have to build and install the dependency into the local repo (mvn install).
I have the same issue. Still didn't find any smart solution, but this sometimes works for me:
Close eclipse
Go to console and do a maven clean install with update flag "mvn clean install -U"
Reboot the computer (logging out and back in didn't help)
Start eclipse and refresh and rebuild your projects

Why is FlexMojos "unable to resolve 'assets/**/*.png' for transcoding"?

I'm trying to mavenize a Flex project using Flash Builder 4 as IDE.
I'm using flexmojos 4.0-beta-7 with flex sdk 4.5.0.19786.
In my pom.xml I have:
<build>
<sourceDirectory>${basedir}/src/main/flex</sourceDirectory>
...
</build>
and I have this directory structure ${basedir}/src/main/flex/assets/icons/**.png.
I have ${basedir}/pom.xml. I followed OpenScales fx samples as a model for my project.
FlashBuilder compiles normally, but invoking $>mvn clean package lots of unable to resolve 'assets/icons/*.png' for transcoding errors are raised.
Does assets folder have to be added explicitly for compiling? How?
Here it is my complete ${basedir}/pom.xml and here the output from $>mvn clean package.
I had the same problem a long time ago. And solved it replacing all the paths in Embed directives from 'assets/icons/food_fr.gif' to '/assets/icons/food_fr.gif'.

compilation problems after setting classpath in tomcat 5.5

I have installed Tomcat 5.5 in windows vista home basic. I have set classpath to
"C:\program files\apache software foundation\tomcat 5.5\common\lib\servlet-api.jar".
now there are two problems.
1. I could not compile my servlets. It says package javax.servlet.* dosenot exist.
2. I could not connect with local host in chrome nor in explorer.
these errors are appearing inspite of server instance running.
Classpath to java sdk and tomcat are different. is it the matter of concern.
Please help.
I have invested considerable amount of time figuring out the problem.
thanx in advance.
I could not compile my servlets. It says package javax.servlet.* dosenot exist.
It means that the classpath for javac is not been correctly specified. It should go like so:
javac -cp .;"/path with spaces/to/servlet-api.jar" com/example/YourServlet.class
Note that you need to surround a path with spaces by doublequotes.
I could not connect with local host in chrome nor in explorer. These errors are appearing inspite of server instance running.
Then you used the wrong domain/port. When running Tomcat at the local machine, the domain should at least be localhost. The actual port can be determined in Tomcat/conf/server.xml file. It defaults to 8080, but can be changed during the Windows setup wizard. The final URL should look like http://localhost:8080. If you use port 80 which is the default HTTP port, then the :80 part can be omitted from the URL.
Classpath to java sdk and tomcat are different.
The %CLASSPATH% environment variable is worthless. Use -cp argument. If you want to avoid long typing/remembering everytime, consider using a .bat file with the command, or a build tool like Ant, or an IDE like Eclipse.
The %JAVA_HOME% environment variable is however important. Tomcat needs to know it in order to have access to the toolset to compile JSP files. The %JAVA_HOME% should point to the installation directory of the JDK.
I have set classpath to "C:\program
files\apache software
foundation\tomcat
5.5\common\lib\servlet-api.jar"
If this means CLASSPATH environment variable, you're learning a valuable lesson: it's worthless. javac.exe and java.exe ignore it; so do all Java EE app servers like Tomcat; so do all IDEs like IntelliJ.
You'll have to add servlet-api.jar to your CLASSPATH using javac.exe -cp every time you compile in a command shell, or add it to your IDE project CLASSPATH, or set it up in Ant.
If you can't connect to localhost using Chrome or Explorer, it probably means that you haven't packaged or deployed your app properly. Make sure you create a valid WAR file and put it in the Tomcat 5.x /webapps directory to deploy.

Resources