My question may sound obvious but i'm quite new working with Wildfly 9 !
I deployed my EAR in server via admin console. My Wildfly is in standalone mode. I couldn't where the ear was deployed ! Is there any specific folder for deployed applications in wildfly ?
Thanks!
[EDIT]
I want to know about deployed location because of class loading in wildfly. I attempted to load a resource which is a .exe from classpasth but it render a wierd path:
Event.class.getResource("/Decorder/Decoder.exe")
I get the following out put in wildfly logs :
C:\apps\wildfly-9.0.2.Final\bin\content\SYSE.ear\SYSE-components-3.0.jar\Decoder\Decoder.exe
I don't know from were the resource path above is coming from !
You have deployed your ear throught the webconsole or cli, it is a managed content and as such is managed through the ContentRepoistory in WildFly. It should be under standalone/data/content + hash part.
This looks quite weird to me : C:\apps\wildfly-9.0.2.Final\bin\content\SYSE.ear
[UPDATED to new question]
This all comes down to how you packaged and configured your deployment.
/Decorder/Decoder.exe might be a valid path if you provided the file in /resources/Decorder/Decoder.exe. This is due to the fact that the classloader will provide all of your resources relative to your root, which in most cases is the jar component.
Note: maybe it is already resolved by removing the typo in your path: /Decorder/Decoder.exe -> /Decoder/Decoder.exe
Related
I suppose same problem as described in question MSAL for Java quickstart sample app throws exception. When using IDE and deploying to embedded tomcat, app works. After spending one day, I figured out what is the problem.
Application AuthPageController specifies #RequestMapping("/msal4jsample/secure/aad"). This works with embedded tomcat. When deployed to tomcat server, tomcat removes application name from path since it is deployment information and exploded folder name depends on war file name. Same application can be deployed multiple times to different folders. Tomcat maps url as /secure/aad and request in this case is never handled. To fix problem, I created array of request mappings #RequestMapping(value = {"/msal4jsample/secure/aad", "/secure/aad"}).
I forked MS Azure repository and made changes. Please take a look at zdenko-s/ms-identity-java-webapp
There are other fixes too.
War file name is specified in pom.xml, no need to rename it. Removed rename step from documentation also
.gitignore wrongly specifies exclude target. Should be */target
Sharing info. Fix in my forked branch
I have two war file that needs to be deployed in tomcat. One is root.war(path will be / as per tomcat docs) and login.war(path will be /login). My root.war has also a path named /login. For some reason my deployment crashed. I would like to know, does it happening becuase of conflict or Am I missing something ? How does tomcat url path working. Any resource will be helpful.
J2ee application (Spring 4.0, jsp ,java 1.7 e) is working great in the dev env (eclipse with built in tomcat)
Once deployed onto tomcat outside eclipse - it will render Gibberish output (class names, file names , configuration file names some binary data)
I didn't find any exception in the logs, according to the debug logs - like the request was processed correctly on the controller side.
I went over the jar packaged in the WAR and it seems like the list is identical to the list in build configuration in eclipse
Any idea what could cause this?
Sample source output:
weird jsp output
EDIT
After some more research I Found three missing jars (eclipse vs deployed version)
javax.servlet-api-3.0.1.jar
junit-4.11.jar
hamcrest-core-1.3.jar
I found this jar packaged in the war:
jsp-api-2.2.1-b03.jar
Should this jar be in the war?
When you are deploying it in standalone tomcat, proper directory structure has to followed. http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html Another important thing is the mapping of your servlets in web.xml
Hope this helps you. Thanks
Issue was corrupted JSP files
What corrupted my JSPs is still a mystery.
I was recently trying to solve class cast exception in our web application. After few tests have found out that the classloader information for our web application right after application server restart are different from classloader information after webapp restart/update (without app server restart).
Classloader information were retrieved using the Manage modules - View Module class loader - Export in the Websphere administration console.
The items (paths to webapp .jar files) in exported XML are the same. But some of the items (as I understand it - these are the classes in webapps' classloader) are different.
Could anybody explain why?
Thanks.
Update:
Here is the difference which is maybe the main problem (I keep getting ClassCastException on XMLSignatureFactory in my log file). This class is contained in xmlsec library and this library is deployed with our webapp war file. The classloader order is set to PARENT LAST, but it seems like sometimes the XMLSignatureFactory from IBM JDK is loaded instead of the xmlsec implementation (after redeploy).
I have described the exception further in this post. After I have changed the settings in MANIFEST.MF file and set up the servlet listener, I could get the application working after every restart, but the redeploy problem still occurs (which is quite annoying).
I got the same problem here. To fix that issue, push xmlsec jar to AppServer\classes then we can override IBM JDK by our lib
I've developed a web application that worked fine in JBoss 4. Now, I need to make it work in Tomcat 6, but I'm having trouble to access some properties file. I use the following code to read read these files:
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(fileName);
if (is == null) {
throw new StartupError("Error loading " + fileName);
}
properties.load(is);
As I've said before, it works fine in JBoss 4. But when I deploy my app in tomcat, it doesn't find the file, assigning null to 'is' variable, causing the StartupError to be thrown. The file is located at WEB-INF/config directory, and the webapp is deployed as a war.
Any solution for this problem?
Thanks,
Alexandre
Put the properties files in WEB-INF/classes.
Or include them in the root of one of your webapp Jar files, although this makes it harder to edit them. This is good if you're selecting properties within a build script and don't want to edit them once deployed.
I assume that Tomcat does not add WEB-INF/config into your webapp classpath.
from http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
WebappX - A class loader is created for each web application that is deployed in a single Tomcat 6 instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application archive, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application archive, are made visible to the containing web application, but to no others.