I have a simple applet that I have created in JDeveloper 11g R1, deploying to Weblogic server 10.3. This applet has a dependency of ojdbc6.jar. I am deploying as a war file.
When I deploy and browse to the html page the applet loads but I get the following exception:
java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
I can see the ojdbc6.jar in the WEB-INF/lib folder when I expand the .war file.
The HTML of the applet page is as follows:
<HTML>
<HEAD>
<TITLE>
Title
</TITLE>
</HEAD>
<BODY>
<APPLET CODE="com.test.Applet" ARCHIVE="ojdbc6.jar" HEIGHT="800" WIDTH="625" ALIGN="bottom">This browser does not support Applets.</APPLET>
</BODY>
</HTML>
Is there a way to get JDeveloper to deploy so that my dependencies are actually accessible by the server?
If you are using an applet then the JDBC jar needs to be included in the applet JAR, not in the web project WAR.
Related
I created a JSP file.
sample.jsp
<%# page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
This is jsp program
</body>
</html>
I placed it here in the samplejsp project.
samplejsp
`-- WebContent
`-- WEB-INF
`-- sample.jsp
I opened it on the following URL.
http://localhost:8080/samplejsp/sample.jsp
But it shows the following error in browser.
404 ERROR
The requested resource (/sample.jsp) is not available.
404 simply means "Not Found".
Either the URL is wrong (note: case sensitive!), or the resource is not there where you think it is.
Just verify the URL and/or verify if the resource is there where you'd expect it to be. You placed sample.jsp in /WEB-INF folder. This way it is not publicly accessible without calling through a front controller servlet.
Put it outside /WEB-INF.
samplejsp
`-- WebContent
|-- WEB-INF
`-- sample.jsp
If you want to keep it in /WEB-INF, then you need to create a front controller servlet which forwards to it in doGet() method as below.
request.getRequestDispatcher("/WEB-INF/sample.jsp").forward(request, response);
Finally "open" the JSP by just calling servlet's actual URL instead of JSP's fictive URL.
See also:
What is WEB-INF used for in a Java EE web application?
Calling servlet from JSP
doGet and doPost in Servlets
It's mostly related to your directory structure or packaging.
Can you please add your directory structure?
Similar to below -
src
|-html\
|-jsp\
Perhaps this should do it
<form action="sample.jsp" method=get>
<input type =submit value="submit">
</form>
Edit - WEB-INF does not allow direct access to JSP.
In my spring boot web application with JSP it didn't worked until I have added this dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
even after configuring view resolver
spring.mvc.view.prefix: /WEB-INF/views/
spring.mvc.view.suffix: .jsp
If you find why this worked please comment.
I want to built simple maven login page using spring and hibernate in eclipse ide but got struck with the http 404 error. when i run the application in tomcat server index.jsp file loads and when i click the login link it shows http status 404 error. how to make eclipse recognize the path of jsp files. If i mention the path as "N:\java\SpringHibernate\src\main\webapp\WEB-INF\pages\login.jsp" it is displaying the content along with tags written in login.jsp file. how to resolve this problem. thanks in advance.
this is my project structure
inde.jsp file
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<html>
<body>
<table align="center">
<tr>
<td>Login</td>
</tr>
</table>
</body>
</html>
from the past 2 months i am using eclipse version:oxygen release candidate 2(4.7.0 RC2) with build id:20170601-1219 and i cant be able to solve the issue.
now i have installed version:2018-12(4.10.0) with build id-20181214-0600 and the issue is resolved. The problem is with the eclipse version. So guys use the right version.
Thank you
i am very new to Eclipse, Spring and AngularJS, This is my first project in Spring and i have referenced AngualarJS and LoginPage.js as below in Eclipse.
But when this application is compiled and Run in Chrome, it throws an error like "server responded with error (resource not found)" as shown below
And my Web.xml is as follows
Is there any setting in Eclipse which i am missing?. Please note it works fine with VisualStudio or if done in normal folder structure. Only when done through Eclipse we get the issue.
If you're using Spring WebMVC, you can put a line like this in your context.xml.
<mvc:resources mapping="/resources/**" location="/resources/" />
This maps your resources folder in WebApp Root (so src/main/webapp/resources) to the /resources/* url. Put your CSS, JS, Images in the Resources folder and then change the link.
i got the answer, it was quite simple, i had to place the js file under WebContent folder and not web-inf, and had to give the reference as follows
<script type="text/javascript" src="appScripts/angular.js"></script>
I read all the posts regarding this error but for some reason it does not work for me...
Here is my folder structure,
I get the error as mentioned in my title,
The code of the if_tag.jsp,
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title><c:if> Tag Example</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:if test="${salary > 2000}">
<p>My salary is: <c:out value="${salary}"/><p>
</c:if>
</body>
</html>
The jstl libraries are located in -
C:\tomcat\webapps\ROOT\WEB-INF\lib
If you are running the maven project as dynamic web project on a server within eclipse, then you should follow the following steps!
open the project properties by right click on the project > properties and select Deployment Assembly.
Click add, select Java build path entries, and choose maven dependencies and then click Finish and Apply.
hope, it may work. it worked for me.
JSTL uses different URIs. You just need to get the right version of it.
You could download using JSTL 1.2 or download the JSTL 1.1 jars.
Javaranch has more detailed list of version/URIs.
I just wanted to note that if you have a project that is Maven based, and you import it into eclipse but receive this error absolute URI, then you might need to follow these directions Maven dependencies not visible in WEB-INF/lib (namely the Deployment assembly step)
To solve this issue copy and paste the jstl-1.2.jar file into your WEB-INF/lib folder directory. This will fix your issue.
I downloaded tomcat, eclipse, Struts framework. Tomcat is working. Where to place eclipse and Struts? I placed eclipse and Struts outside tomcat folder. The needed jar files are stored inside eclipse current folder. I'm getting error.
<%#taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello World</title>
</head>
<body>
<bean:write name="helloWorldForm" property="message"/>
</body>
</html>
unknown tag:bean.write
Eclipse is an IDE. It's used to develop Java applications. Not just one application, but several ones. You shouldn't place any app-specific jar into the eclipse folder.
Struts (and not strut or struct) is a web framework. Its jars must be put in the WEB-INF/lib folder of your deployed application. In an Eclipse web project, the location for them is (typically) <yourProjectDirectory>/WebContent/WEB-INF/lib.