Error when deploying WAR file - deployment

I have a war file and when deploying it thro the admin console in websphere i am getting the following error after specifying the war file location and the context-root.
The EAR file might be corrupt or incomplete.
org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml
Any suggesstions to resolve this issue?
I also unpacked the war file and checked that the web.xml file is present in the web-inf folder.
Cheers,
Deena

I had the same problem and after much searching (and even posting a bounty for this problem), I found the issue was comments in web.xml.
I was lucky enough to have a source branch that didn't have the comments and worked and this other branch that did have the comments and broke.
Removing the comments allowed WebSphere's validator to get past that error... fun stuff..

Related

Class loading issue with Eclipse RAP and WebLogic 12.2.1.3

Whilst deploying an Eclipse RAP war file on WebLogic 12.2.1.3, we are encountering the following error;
java.lang.LinkageError: loader constraint violation: loader previously initiated loading for a different type with name "org/aopalliance/aop/Advice"
After performing some analysis we identified the issue is due to WebLogic 12.2.1.3 shipping with org.glassfish.hk2.external.aopalliance-repackaged.jar within oracle_common\modules, and this conflicts with com.springsource.org.aopalliance_1.0.0.jar, within the WEB-INF\plugins directory of our WAR file.
We have tried a few things to remediate this, but with no luck so far;
Removed org.glassfish.hk2.external.aopalliance-repackaged.jar from oracle_common\modules (WebLogic deploys but then shuts itself down)
Remove com.springsource.org.aopalliance_1.0.0.jar from the WAR file (WebLogic starts, but does not deploy the bundles within the WAR file)
Updated weblogic.xml in the WAR file with;
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>org.aopalliance.*</package-name>
</prefer-application-packages>
</container-descriptor>
Copied com.springsource.org.aopalliance_1.0.0.jar to the WEB-INF\lib folder of the WAR, with the above weblogic.xml change
Any suggestions of other changes we could try would be much appreciated.
Many Thanks
Mike
try updating the launch.ini in your war file, setting the values for osgi.parentClassloader and osgi.contextClassLoaderParent to ext :-
osgi.parentClassloader=ext
osgi.contextClassLoaderParent=ext
Cheers
Rod

i got a eclipse neon EE ver. and made a spring project, but it's o stuck like those, 2 errors

2 errors : like this (follow the pict)
enter image description here
in a detail.. it's said
1.
Description Resource Path Location Type
Archive for required library: 'C:/Users/Administrator/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar' in project 'spring' cannot be read or is not a valid ZIP file spring Build path Build Path Problem
2.
Description Resource Path Location Type
The project cannot be built until build path errors are resolved spring Unknown Java Problem
i think it's cuz of a wrong path or no jar file
yeah but so what?
could you advice me some steps to solve it? plz...
Check the jar file written in the error message:
C:/Users/Administrator/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar
Is it there? Can you open it manually as a zip?
Occasionally it happens that the jar file is not correctly downloaded from the artifactory (when it happens it usually has 0kb size).
Delete the jar file, and let Maven redownload it again, it usually does the trick.
If it does not solve it, there may be a permission problem (does Eclipse has right to write under that path?), or an artifactory problem (are you using the central repository?) or even antivirus could block the download.

project working in tomcat but not working from eclipse. error :cant find log4j.properties

I have a struts project which, I have imported to eclipse from a war file.
This is working perfectly by deploying it in tomcat. But the same after importing is showing up the error :
log4j:ERROR Could not read configuration file from URL [file:/D:/xxxfolder/xxxworkspace/xxxproject/WebContent/WEB-INF/classes/log4j.properties].
java.io.FileNotFoundException: D:xxx\xxx\xxx\WebContent\WEB-INF\classes\log4j.properties (The system cannot find the path specified)
I have the log4j.property in src folder.
Please help with proper solution to get rid of it !
Let me know if needed more info
EDIT!
I got the root of problem but cant find the solution
Bu default the ouput build path for src in eclipse is :build/classess. but the tomcat is searching the file at webContent/web_inf/ Classess/ Can you suggest how to do it . how to change the output file of only log4j to the specific it is tomcat is searching in.
In the comments above, the conclusion is that, the path is incorrect. After modifying the path, the issue is resolved.

tomcat server giving issues to run the application

I am trying to run the application. just i installed the tomcat and netBeans.
It is giving following error. if i try to give build alone,,, build is successful. but i am unable to deploy in server ...
Created dir: D:\Test\build\generated\src
Created dir: D:\Test\build\generated\classes
Compiling 1 source file to D:\Test\build\generated\classes
Undeploying ...
undeploy?path=/excelRD
OK - Undeployed application at context path /excelRD
In-place deployment at D:\Test\build\web
D:\Test\build\web\META-INF\context.xml (The system cannot find the file specified)
D:\Test\nbproject\build-impl.xml:686: The module has not been deployed.
Please do needful
The error message seems clear you need a file context.xml in your project.
In a regular apache project created with Netbeans, you have in the directory Web Pages an other directory names META-INF and in this directory the file context.xml.
Try to respect this architecture. The minimal context.xml contant is :
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/excelRD"/>
He may also be seeing an issues I've seen on NetBeans for years. You have a perfectly valid context.xml file that can't be found by NetBeans during deployment. If you open the file, touch it in anyway (type in a character, delete that character, then save), the problem goes away. I've had this happen so many times that I've gotten in the habit of always touching the context.xml file before I deploy.

Problems deploying WAR file from Netbeans to Tomcat

I'm trying to configure build.xml files for build forge, but it seems like I am having trouble with the libraries required for the java servlet pages. I am actually trying to use OWASP's AntiSamy library but I keep getting a Policy Exception followed by a file not found
org.owasp.validator.html.PolicyException: java.io.FileNotFoundException: C:\Program%20Files \Apache%20Software%20Foundation\apache-tomcat-6.0.29\webapps\XSSDemo\WEB-INF\classes\...\antisamy.xml (The system cannot find the path specified)
The antisamy.xml file is definitely in this location, however.
So I tried using Netbeans to clean and build a WAR file that I would have expected to work, since the web app works fine when I run it through Netbeans. However, I get the same problem. Is there possible some reference that Netbeans is creating when I run the app through the ide that is not occurring in the WAR deployment? Could the URL Encoding in the antisamy.xml location be causing problems?
Thanks for the help.
Edit: I compressed the long class path into the three dots here. The actual response has the actual class path. I am not getting any kind of security errors.
The problem I had was not actually with the deployment--it was the file reference itself in my java servlet. The encoding in the path '%20' in the Program Files folder caused a FileNotFoundException. The reason this did not occur in netbeans is because the deployed files are in a c:\users... folder and there are no spaces to be encoded. The also explained why the application ran well on other computers with their tomcat folders directly on the root directory. This is the actual solution to my problem. Thanks for all your help.