On the server side of my GWT app I use classes from the org.apache.commons.httpclient package. These classes are conveniently packaged in gwt-dev.jar distributed with GWT. I include this jar (along the gwt-servlet.jar) in the WEB-INF/lib of the war.
When deploying the produced war file on glassfish and calling the page I get the following exception in the server logs (and an RPC fail)
NoClassDefFoundError: org/apache/commons/httpclient/HttpException
What should I do so that glassfish finds the classes in the gwt-dev.jar?
-- more details --
As an SSCCE which reproduces the problem, I have modified class GreetingServiceImpl of the GWT example:
import org.apache.commons.httpclient.HttpException;
public String greetServer(String input) throws IllegalArgumentException {
try {
if(input.equals("hello")){
throw new HttpException();
}
} catch (HttpException e) {
throw new RuntimeException(e);
}
... the rest of the GWT example app
Here's the content of the war
> jar -tf mytest.war
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/com/
WEB-INF/classes/com/mytest/
WEB-INF/classes/com/mytest/client/
WEB-INF/classes/com/mytest/server/
WEB-INF/classes/com/mytest/shared/
WEB-INF/lib/
mytest/
mytest/gwt/
mytest/gwt/standard/
mytest/gwt/standard/images/
mytest/gwt/standard/images/ie6/
MyTest.css
MyTest.html
WEB-INF/classes/com/mytest/MyTest.gwt.xml
WEB-INF/classes/com/mytest/client/GreetingService.class
WEB-INF/classes/com/mytest/client/GreetingServiceAsync.cla
WEB-INF/classes/com/mytest/client/MyTest$1.class
WEB-INF/classes/com/mytest/client/MyTest$1MyHandler$1.clas
WEB-INF/classes/com/mytest/client/MyTest$1MyHandler.class
WEB-INF/classes/com/mytest/client/MyTest.class
WEB-INF/classes/com/mytest/server/GreetingServiceImpl.clas
WEB-INF/classes/com/mytest/shared/FieldVerifier.class
WEB-INF/lib/gwt-dev.jar
WEB-INF/lib/gwt-servlet.jar
WEB-INF/web.xml
mytest/0A9476898799A150D840F0B1C3672921.cache.png
mytest/2E5321B05D040C654474157464A1320D.cache.html
mytest/342DCE11554A2ED2AAE7C85966745477.cache.html
mytest/396F806CD63ABD414BFBB9D57429F05B.cache.png
mytest/505B1AEFC510FA6C8E519C08BD073CE0.cache.html
mytest/8C8B81BFBAD2494F16B95F537039AC9C.gwt.rpc
mytest/B33A642CF9F25C17BB1B43D744B059AE.cache.html
mytest/C8061F2305971473D1402197D362AAFE.cache.html
mytest/DF7764EEC1903CD03C9545B354D8D8E4.cache.png
mytest/E224554766C17094274FFD5F9B5E2DCC.cache.html
mytest/E44767377485D18D6B6864F65BA8EF73.cache.png
mytest/EDC7827FEEA59EE44AD790B1C6430C45.cache.png
mytest/clear.cache.gif
mytest/gwt/standard/images/corner.png
mytest/gwt/standard/images/corner_ie6.png
mytest/gwt/standard/images/hborder.png
mytest/gwt/standard/images/hborder_ie6.png
mytest/gwt/standard/images/ie6/corner_dialog_topleft.png
mytest/gwt/standard/images/ie6/corner_dialog_topright.png
mytest/gwt/standard/images/ie6/hborder_blue_shadow.png
mytest/gwt/standard/images/ie6/hborder_gray_shadow.png
mytest/gwt/standard/images/ie6/vborder_blue_shadow.png
mytest/gwt/standard/images/ie6/vborder_gray_shadow.png
mytest/gwt/standard/images/splitPanelThumb.png
mytest/gwt/standard/images/vborder.png
mytest/gwt/standard/images/vborder_ie6.png
mytest/gwt/standard/standard.css
mytest/gwt/standard/standard_rtl.css
mytest/hosted.html
mytest/mytest.nocache.js
And the full exception stacktrace
PWC1382: Allocate exception for servlet greetServlet java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException at
java.lang.Class.getDeclaredConstructors0(Native Method) at
java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at
java.lang.Class.getConstructor0(Class.java:2699) at
java.lang.Class.newInstance0(Class.java:326) at
java.lang.Class.newInstance(Class.java:308) at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1132) at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Content of gwt-dev.jar, (total of 11000 classes and packages)
> jar -tf gwt-dev.jar
META-INF/MANIFEST.MF
LICENSE.txt
META-INF/
META-INF/LICENSE
...
com/gargoylesoftware/htmlunit/...
com/google/gwt/core/...
com/google/gwt/dev/...
com/steadystate/css/...
java_cup/runtime/...
javax/management/...
javax/servlet/...
javax/xml/...
mx4j/...
net/sourceforge/htmlunit/...
org/apache/bcel/...
org/apache/catalina/...
org/apache/commons/...
org/apache/commons/httpclient/
...
org/apache/commons/httpclient/HttpContentTooLargeException.class
org/apache/commons/httpclient/HttpException.class
org/apache/commons/httpclient/HttpHost.class
...
org/apache/coyote/...
org/apache/html/...
org/apache/jasper/...
org/apache/tomcat/...
etc...
You should add the commons-httpclient.jar (or httpclient-4.0.1.jar - depends on distribution) to your 'WEB-INF/lib directory'.
You can download it from here
Related
What i'd like to do:
Creating an executable Jar using gradle, and eclipse as IDE.
Jar should include all libs required to run, and could be used inside a docker container.
Issues so far:
org.springframework.boot is not included in the Jar.
Code:
src/main/java/SampleController.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
#EnableAutoConfiguration
public class SampleController {
#RequestMapping("/")
#ResponseBody
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}
build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE")
}
}
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:21.0'
api 'org.springframework.boot:spring-boot-starter-web'
api 'org.springframework.boot:spring-boot-starter'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
springBoot {
mainClass = "SampleController"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
Command used:
In workspace/project/build/libs
java -jar project.jar
Error:
java : Exception in thread "main" java.lang.reflect.InvocationTargetException
At line:1 char:1
+ java -jar RSSFeedAggregator.jar
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Exception in th...TargetException:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at SampleController.main(SampleController.java:18)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
I'm kind of a newbie when it comes to this. Does anyone has any ideas on how to resolve my problem ?
guess I found the solution.
From my understanding, when running directly in eclipse, gradle api / implementation automatically add the jars at runtime.
But when creating the fat jars with :bootRepackage, runtime libs need to be explicitly added. (The program runned well on eclipse directly)
runtime 'org.springframework.boot:spring-boot-starter'
runtime 'org.springframework.boot:spring-boot-starter-web'
This resolved my problem.
I won't close the topic yet if anyone has something to add on this issue.
I want to run a following project:
https://gforge.inria.fr/plugins/mediawiki/wiki/melinda/index.php/RDF_keys
In the project page, they resume the steps as the following:
1-git clone https://gforge.inria.fr/git/melinda/melinda.git
2-cd melinda/trunk/rdfifd/
3-ant jar
4- java -jar pseudo-keys.jar -t -i /path/to/rdf_file -o /path/to/output/file
So how can i integrate and run this project in an eclipse project?
I already following these setp on a linux command line and it is work well and pseudo-keys.jar is generated. I take this .jar and In my laptop i write the following code:
public class TestDriver {
/** Executes a command */
public static void execute(String cmd, File folder) throws Exception {
Process p = Runtime.getRuntime().exec(cmd, null, folder);
BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String s1, s2 = null;
while (null != (s1 = bri.readLine()) || null != (s2 = bre.readLine())) {
if (s1 != null) System.out.println(s1);
if (s2 != null) System.err.println(s2);
}
p.waitFor();
}
public static void main(String[]args) throws Exception{
String cmd = "java -jar C:/Users/user/Desktop/pseudo-keys.jar -t -i C:/Users/user/Desktop/randomLocation/datasetLocation/restaurant1.rdf -o C:/Users/user/Desktop/randomLocation/key.xml";
execute(cmd, null);
}
The execution give the following error:
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
Any help please to run the code? Where is my mistake?
Thank you
Copy the URI https://gforge.inria.fr/git/melinda/melinda.git to the clipboard
In the Git Repositories click the Clone a Git Repository button and follow the wizard (if the dialog is not prefilled, enter the URI manually)
Right-click the node melinda [master] > Working Tree > trunk > rdfifd and choose Import Projects... and follow the import wizard
In the Package Explorer or Project Explorer open the file rdfifd/build.xml via double-click
In the Outline view right-click the target jar and choose Run As > Ant Build
On the command line run java -jar pseudo-keys.jar -t -i /path/to/rdf_file -o /path/to/output/file. Alternatively, you can skip step 4 and 5 and run fr.inrialpes.exmo.rdfkeys.KeyExtraction as Java application with the necessary arguments (Run > Run Configurations..., in tab Arguments field Program arguments).
I finally managed to get LuaJava to build on OSX and now I am running into trouble using it in Eclipse. I put the jnilib in my system path and when I go to the directory where I built it I can run the Console like this:
$ java -cp "luajava-1.1.jar" org.keplerproject.luajava.Console
API Lua Java - console mode.
> print("Hello World!")
Hello World!
> exit
$
So I'm guessing that means that it is built and installed correctly. I added the jar to my project using the "Add External Jar" in the Java Build Path property window. But when I try to use it I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: ScriptEngineSample
Caused by: java.lang.ClassNotFoundException: ScriptEngineSample
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Here is all of my code:
LuaWarrior.java
public class LuaWarrior
{
public static void main(String[] args)
{
new Game().start();
}
}
Game.java
import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;
public class Game
{
private LuaState _lua;
public Game()
{
_lua = LuaStateFactory.newLuaState();
_lua.openLibs();
}
public void start()
{
_lua.LdoFile("scripts/hello.lua");
}
}
It turns out that it doesn't need to be in the system path, but is needs to be in the JVM Library folder.
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/
I am trying to load a class dynamically from a jar file. It worked fine on a Ubuntu linux box ( Sun Java Version 1.6.0_24 (b07).
When I tried to run the same thing on Windows (Windows 7, Java version "1.6.0_14") it fails with Class Not Found exception.
Following is code :
try {
String jarFile = "/sqljdbc4.jar";
File newf = new File(jarFile);
System.out.println(newf.getAbsolutePath());
System.out.println("File exists ? :" + newf.exists());
String urlPath = "jar:file://" + newf.getAbsolutePath() + "!/";
System.out.println(urlPath);
ClassLoader cur = Thread.currentThread().getContextClassLoader();
URL[] jarUrlArray = { new URL(urlPath) };
URLClassLoader cl = URLClassLoader.newInstance(jarUrlArray, cur);
Class c = Class.forName(
"com.microsoft.sqlserver.jdbc.SQLServerDriver", true, cl);
Method m[] = c.getMethods();
for (Method mm : m) {
System.out.println(mm.getName());
}
} catch (Exception e) {
e.printStackTrace();
}
While running on Linux, jar is placed at root and for Windows its at c:\ (source and binaries are in some folder on C:\ so "/sqljdbc4.jar" resolves to c:\sqljdbc4.jar on windows, I have made sure that correct jar location in passed to classloader for both the platforms.
Following is the stack trace i get on windows
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:594)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at DemoClass.loadAClass(DemoClass.java:31)
at DemoClass.main(DemoClass.java:14)
NOTE : You can use any jar that u have to try this out. I was playing with MS SQL Server JDBC Driver jar.
Thanks !
-Abhijeet.
Try using this to create the URL rather than manually building the string:
URL[] jarUrlArray = { newf.toURI().toURL() };
I googled but can't find a solution for this. It is from Core JSF 3rd.
I did:
1) Included JSF Mojarra in Build path.
2) Included MySQL JDBC driver in Build path.
3) Copied MySQL JDBC driver to Tomcat "lib" folder and "ext" JDK folder.
4) I tested JDBC driver with a small Java app and it succeeded.
CustomerBean from corejsf source code:
public class CustomerBean {
#Resource(name="jdbc/corejsf")
private DataSource source;
public ResultSet getAll() throws SQLException {
Connection conn = source.getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery("SELECT * FROM Customers");
// return ResultSupport.toResult(result);
CachedRowSet crs = new com.sun.rowset.CachedRowSetImpl();
// or use an implementation from your database vendor
crs.populate(result);
return crs;
} finally {
conn.close();
}
}
}
Error:
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/DatabaseTest] threw exception [/index.jsp(12,3) '#{customer.all}' Error reading 'all' on type com.corejsf.CustomerBean] with root cause
java.lang.NullPointerException
at com.corejsf.CustomerBean.getAll(CustomerBean.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:106)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
at javax.faces.component.UIData.getValue(UIData.java:554)
at javax.faces.component.UIData.getDataModel(UIData.java:1248)
at javax.faces.component.UIData.setRowIndex(UIData.java:447)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:81)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:823)
at javax.faces.component.UIData.encodeBegin(UIData.java:937)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1611)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at com.sun.faces.application.view.JspViewHandlingStrategy.doRenderView(JspViewHandlingStrategy.java:420)
at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:209)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
You need to configure a JNDI datasource with the name jdbc/corejsf in Tomcat.
I suspect that datasource is not injected, since nothing in your class path interprets the #Resource annotation. As far as I know, #Resource is an EJB annotation, but Tomcat is no EJB container. Try looking up the datasource programatically.