I am getting an error when deploying an EAR file which contains a web service and a web application. I get a NoClassDefFoundError when I deploy the application because the server is looking in the wrong folder for the class file.
The server (WebLogic) thinks the class file should be in WEB-INF/classes, but it is in <project-root>/classes.
How do I change where WebLogic should look for class files? I already tried the classpath, doesn't work.
That is happening because this is the structure of the web application according to the specification. Check this out: https://docs.oracle.com/javaee/6/tutorial/doc/bnadx.html
Related
I have been testing my tomcat 8 setup on debian 9. Everything seems fine until I try to deploy a helloServlet WAR file through tomcat 8 manager. I created the very simple example program following the instruction here.
I use tomcat manager to upload the HellowServlet.war from my working directory. Then I can access it though http://localhost:8080/HelloServlet/sayhello
The program works just fine. However, no matter how I search (/etc/tomecat8 /usr/share/tomcat*), I just can not find the war file or any components inside of it. I really want to know the exact location of my application file. Anyone may tell me where the application files are stored by the tomcat 8 mananger?
More update:
I just tried to upload the same war file again, and I got following message from tomcat
FAIL - War file "HelloServlet.war" already exists on server
That means the war file is sitting somewhere on the server, but the path is unknown to me.
Found it.... it's inside /var/lib/tomcat8/webapps
However, I can not find any configuration file in tomcat 8 describing that it uses /var/lib/tomcat8 as one of its working directory.
I'm trying to write code that will load *.html file from application .ear and display it. The structure of my application is:
application
-src
-main
-java
-my.package.few.folders
-Class.java
-webapp
-my.html
I'm new in Java and weblogic so I'm not able to figure it out by myself and all threads I found in internet are mostly the same. File should be accessible using:
Class.class.getClassLoader().getResource("main/webapp/my.html");
The problem is that my application is deployed on weblogic and above code gives me path to a weblogic domain (not my application ear where are *.html files). So using this code I'm always getting null pointer exception because .ear is hidden inside few folders in weblogic domain. I want to avoid giving specified path to .ear in weblogic, because it need to work on different servers and with only managed server name changed it will crash. How can I get straight into my .ear, not through weblogic domain?
Application Server : IBM Websphere
Java 6
Issue :
Below is the folder structure of web application :
WEB-INF/libs/props/
The issue is below code is not working :
this.getClass().getResourceAsStream('/props'/+fileName) where fileName is a valid file name inside props folder of WEB-INF/lib/pros.
The class which is calling above method is inside a JAR and included in lib
The above call returns NULL.
The same set up works on tomcat with web application deployed in expanded mode integrated inside Inteliij IDE. On environment where this issue is coming , the application is deployed as ear
Please help as I not able to get any clue on this
The jar files under WEB-INF/lib are in the classpath. Not WEB-INF/lib itself.
The file should be in one of those jars, or under WEB-INF/classes (which is in the classpath)
I'm trying to work out a proof of concept with SSO using JOSSO. However, i'm having issue installing JOSSO on my server, which is a Weblogic 10 instance.
I have managed to install JOSSO in my domain. However when i start the server, there's an error saying it failed to parse one of the configuration XML file on the server because the file is not found. I double check the directory and the XML file is actually there.
The exception:
SEVERE: IOException parsing XML document from class path resource
[josso-gateway-config.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[josso-gateway-config.xml] cannot be opened because it does not exist
Also another issue i'm facing is, on my production server, the webapp directory is actually in a separate partition as the Weblogic home folder. I found that the JOSSO installation program will assume that both of them are located in the same directory. Is there any way i can customize this?
Thanks in advance.
Managed to get it solved. Posting it here in case can help someone.
Due to the setup of my weblogic environment, i have decided to explode the war file, and deploy it as an exploded directory. Steps i followed:
Use WinRAR and unrar the war file into a directory
Copy all the xml configuration files into the classes folder
Rename one of the stores configuration file into josso-gateway-stores.xml
Deploy the exploded directory
I have some java client code that is making a connection to a web service in a war sitting on a remote server. I'm using myeclipse 10.0, java 1.6, cxf 2.2, the embedded tomcat 6 localhost server and I'm running tomcat 6 off the command line, both tomcats are running on the same machine.
When my wsdl file points to the service on the remote server everything works fine, however, when I set up everything on my one machine, I get a java.io exception when I try to reach the service.
I setup both instances of tomcat on different ports, I can see everything loads up fine with ProcessExplorer and using netstat I can see that the ports are working with their listeners with no conflicts. I used the information from this link to setup tomcat instances. I then copied the war file over to the webapps directory and I saw that tomcat exploded the classes and loaded them. We are also using a cacerts file for ssl authentication and I verified that it is in the correct location in the jvm.
Here is the error: Caused by: java.io.IOException: //
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2071)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2022)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1947)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:472)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:302)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:123)
at $Proxy71.get(Unknown Source)
I'm using this url to hit the webservice endpoint:
http://localhost:7070/<root context>/<serviceName>
Any ideas why this isn't working or if there is a better way to do this?
Aftermath:
The war file I'm using was from a repo and added the date to it's name when I downloaded it. I changed the name of the war to match the context root by stripping off the date, redeployed it and everything started working.
The war file I'm using was from a repo which added the date to it's name when I downloaded it. When I revisited what I had done, I realized this issue, so I changed the name of the war to match the context root by stripping off the date, redeployed it and everything started working.
Just copy the war file in the tomcat webapps directory and then Restart Tomcat. The war file will automatically be converted into the app folder