Caught exception while loading file struts-default.xml - exception

I'm not that new to Java. I've done plenty of stuff with it before. But I'm migrating from PHP to Java Servlet/JSP (which I am new to) and I can't figure out this error to save my life. I installed Tomcat6 using Ubuntu 9.04's Synaptic Package Manager and it works like a charm. But when I put struts in my WEB-INF/lib directory and try to make a struts app, I get the below in the log file.
I used the struts-blank.war to start the project, so the web.xml is the same as provided in struts 2.1.8.1.
It appears that there is some issue with reading the struts-default.xml file.
Thanks in advance
SEVERE: Exception starting filter struts2
Unable to load configuration. - Class: java.security.AccessControlContext
File: AccessControlContext.java
Method: checkPermission
Line: 342 - java/security/AccessControlContext.java:342:-1
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:123)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:769)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177)
Caused by: Unable to load configuration. - Class: java.security.AccessControlContext
File: AccessControlContext.java
Method: checkPermission
Line: 342 - java/security/AccessControlContext.java:342:-1
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 36 more
Caused by: Caught exception while loading file struts-default.xml - Class: java.security.AccessControlContext
File: AccessControlContext.java
Method: checkPermission
Line: 342 - java/security/AccessControlContext.java:342:-1
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:902)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:143)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:110)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:168)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 38 more
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission xwork.saxParserFactory read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
at java.lang.System.getProperty(System.java:669)
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:78)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893)
... 42 more

I had a brain storm and figured this out myself. Although I don't think this is the most secure solution, but it works for my purposes and I'm not that concerned because it's a local dev server that only listens on the loopback interface (127.0.0.1).
Anyway, the solution is to add this to the bottom of /etc/tomcat6/policy.d/50local.policy
grant codeBase "file:${catalina.base}/webapps/-" {
permission java.security.AllPermission;
};

Related

Openshift: permission denied while installing New Relic Jar file

I am trying to install new-relic jar to my Openshift application (wildfly cartridge), but it fails with permission denied. Here is the log
\> java -jar newrelic.jar install
Jan 29, 2015 15:01:14 -0500 [64858 1] com.newrelic INFO: Agent is using Logback
***** ( ( o)) New Relic Java Agent Installer
***** Installing version 3.13.0 ...
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf.20150129_150114 (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.backup(EditableFile.java:251)
at com.newrelic.agent.install.SelfInstaller.backup(SelfInstaller.java:125)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:51)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:35)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
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:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:263)
at com.newrelic.agent.util.EditableFile.append(EditableFile.java:240)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:55)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:35)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
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:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Added agent switch to start script /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf.20150129_150114 (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.backup(EditableFile.java:251)
at com.newrelic.agent.install.SelfInstaller.backup(SelfInstaller.java:125)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:51)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:37)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
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:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:263)
at com.newrelic.agent.util.EditableFile.append(EditableFile.java:240)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:55)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:37)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
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:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Added agent switch to start script /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf
No need to create New Relic configuration file because:
.:. A config file already exists: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/newrelic/newrelic.yml
***** Install successful
***** Next steps:
You're almost done! To see performance data for your app:
.:. Restart your app server
.:. Exercise your app
.:. Log into http://rpm.newrelic.com
Within two minutes, your app should show up, ready to monitor and troubleshoot.
If app data doesn't appear, check newrelic/logs/newrelic_agent.log for errors.
How can I install it? Where can I get permission?
Looks like NewRelic is attempting to create a backup of the WildFly configuration file which it finds at ~/wildfly/bin/standalone.conf. Unfortunately it fails due because the ~/wildfly/bin is locked by the WildFly cartridge as you can see by its permissions and entry in the cartridge's managed_files.yml:
\> ls -ld wildfly/bin/
drwxr-xr-x. 6 root 544c2c3be0b8cdf8da000253 4096 Dec 23 20:01 wildfly/bin/
\> cat wildfly/metadata/managed_files.yml
---
[...]
locked_files:
- bin/
- bin/*
[...]
I see three options, in order of complexity.
See if newrelic.jar accepts an flag to not perform a backup of the config file.
Since it looks like newrelic.jar is trying to automatically modify standalone.conf for you, try running this step on a local environment with WildFly where you do have permissions. Then check in the new standalone.conf to OpenShift git.
Fork the WildFly cart repo and remove the bin/ and bin/* entries from the locked_files key in managed_files.yml. But make sure to create these manually within the cart's bin/setup script, as locking would normally do that for you. See Locking cartridges for more info.

creating a connection in eclipse - ClassNotFoundException: com.mysql.jdbc.Driver

I am not doing anything in code - I just created an eclipse connection and can't seem to be able to ping it. The connection properties :
The jar is where I say it is ($GLASSFISH_HOME\domains\domain1\lib\ext) but I am getting :
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:297)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:81)
at org.eclipse.datatools.enablement.internal.mysql.connection.JDBCMySQLConnectionFactory.createConnection(JDBCMySQLConnectionFactory.java:28)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
That zip is very likely the distribution zip of MySQL Connector/J, inside of that zip is the mysql-connector-java-5.1.27-bin.jar library with the driver. So you need to unzip it first and then add that jar-library instead of the zip.

Hive built-in functions not working

I'm using Hadoop 0.20.2 with Hive 0.11. I have succesfully inserted into hive/hdfs some csv-files in seperate tables. selects and joins work flawlessly. When trying to analyse some data, i needed to make use of the built in functions of hive like:
substr
to_date
rand
etc.
for example:
select sid, request_id, to_date(times), to_unix_timestamp(times) from contents where sid = '5000000032066010373';
sid and request id are strings here, times is a timestamp column
Unfortanetely i only get errors (always the same error stack) when using these functions:
java.lang.RuntimeException: Error in configuring object
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:354)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
... 5 more
Caused by: java.lang.RuntimeException: Error in configuring object
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:34)
... 10 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
... 13 more
Caused by: java.lang.RuntimeException: Map operator initialization failed
at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:121)
... 18 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonFactory
at org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple.<clinit>(GenericUDTFJSONTuple.java:56)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:526)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:520)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.<clinit>(FunctionRegistry.java:423)
at org.apache.hadoop.hive.ql.exec.DefaultUDFMethodResolver.getEvalMethod(DefaultUDFMethodResolver.java:59)
at org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge.initialize(GenericUDFBridge.java:154)
at org.apache.hadoop.hive.ql.udf.generic.GenericUDF.initializeAndFoldConstants(GenericUDF.java:111)
at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.initialize(ExprNodeGenericFuncEvaluator.java:141)
at org.apache.hadoop.hive.ql.exec.Operator.initEvaluators(Operator.java:970)
at org.apache.hadoop.hive.ql.exec.Operator.initEvaluatorsAndReturnStruct(Operator.java:996)
at org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:60)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:375)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:451)
at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:407)
at org.apache.hadoop.hive.ql.exec.FilterOperator.initializeOp(FilterOperator.java:78)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:375)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:451)
at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:407)
at org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:186)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:375)
at org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:543)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:375)
at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:100)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory
what am i doing wrong here?
SHOW FUNCTIONS;
shows me that these functions are in there ...
Try updating the jackson*.jar in your HADOOP_HOME/lib with the ones in HIVE_HOME/lib, restart Hadoop and try submitting the job.
I met the same problem while using hive + apache hadoop 0.20.2
the problem is that hadoop-0.20.2 doesn't have these jackson jars in the lib folder, so either you add it manually in the hive console every time:
add jars $HIVE_HOME/lib/jackson-core-asl-1.8.8.jar $HIVE_HOME/lib/jackson-jaxrs-1.8.8.jar $HIVE_HOME/lib/jackson-mapper-asl-1.8.8.jar $HIVE_HOME/lib/jackson-xc-1.8.8.jar;
or you copy all these jars to each machine in the cluster?
try updating the jackson*.jar in your HADOOP_HOME/lib with the ones in HIVE_HOME/lib, restart Hadoop and try submitting the job.
Thanks it worked

When compiling my game into an Executable Jar, The game doesnt work

I have created a small game using Slick 2D and the LWJGL. When testing the program in Eclipse, everything works fine. As soon as I try to run my exported jar I get this message in the terminal:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
I am really not sure what to do. Any help?
Use JarSplice :)
You just show it where to find the native files, the LWJGL and Slick JARs, and the JAR you create with eclipse.

Tomcat 6 and MySQL 5.x connection error on Ubuntu

When attempting to connect to a MySQL 5.x database in a JSP webapplication running on Tomcat 6, I am getting the following exception:
org.apache.jasper.JasperException: javax.servlet.ServletException: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3307 connect,resolve)
STACKTRACE:
java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3307 connect,resolve)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)
at com.mysql.jdbc.Connection.<init>(Connection.java:405)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:200)
at org.apache.jsp.doLogin_jsp._jspService(doLogin_jsp.java:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:636)
What could be the cause and how can I fix it?
Here is the relevant bit of the trace:
java.net.SocketException MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3307 connect,resolve)
The webapp doesn't have the permission to connect/resolve the mentioned socket. You need to configure it at Tomcat level. Open /conf/catalina.policy and add the following block of code:
grant {
permission java.net.SocketPermission "localhost:3307", "connect,resolve";
};
If you want to be a bit more restrictive, e.g. granting access to a specific JDBC driver only which is present in /lib/filename.jar, then add this instead:
grant codeBase "jar:file:${catalina.home}/lib/filename.jar!/-" {
permission java.net.SocketPermission "localhost:3307", "connect,resolve";
};
Unrelated to the concrete problem, the following lines
at java.sql.DriverManager.getConnection(DriverManager.java:200)
at org.apache.jsp.doLogin_jsp._jspService(doLogin_jsp.java:70)
indicate that you're connecting the DB inside a JSP file. Maybe you're just starting and learning, but I would only mention that this is not the best practice. DB connectivity should be done in its own classes which you in turn use in a servlet class which in turn forwards to the JSP which in turn displays the results. Calling the servlet by URL should then yield the same results, but you end up with better reuseable and maintainable code.