Tomcat 6 not deploying webapp folders OS X - osx-lion

I have used MacPorts to install tomcat 6 for use with launchctl.
launchctl start org.apache.tomcat provides the following result in Catalina.date.out:
java.io.FileNotFoundException: /opt/local/share/java/tomcat6/conf/Catalina/localhost/host-manager.xml (No such file or directory) at java.io.FileOutputStream.open(Native Method) and so on
Lo and behold, there is no folder called Catalina in conf.
I don't know if this is responsible for the applications not being deployed or not, but I felt that since it's a severe issue it should be noted.
Then comes SEVERE: Error deploying web application directory manager
java.io.FileNotFoundException: /opt/local/share/java/tomcat6/conf/Catalina/localhost/manager.xml (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
and for each of the folders in the webapps folder, I get
The scratchDir you specified: /opt/local/share/java/tomcat6/work/Catalina/localhost/examples is unusable.
I have been googling this for some time now, but I have not yet stumbled across an answer.

The issue was to do with Tomcat from Macports and permissions.
My end solution was to install and configure tomcat manually.

Related

Error Setting up websphere local development server

Have installed the websphere 8.5.5 for developers and also websphere eclipse development tools. setup a new server in eclipse with websphere and also built a new profile.
The server starts fine the and when i want to set it up via a jython script (Administration > Run administrative script ...) i get the following error.
Does anyone know what the problem might be:
Exception in thread "main" java.lang.NoClassDefFoundError: Files
Caused by: java.lang.ClassNotFoundException: Files
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688)
at java.lang.ClassLoader.loadClass(ClassLoader.java:667)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
Could not find the main class: Files. Program will exit.
This looks like a classic whitespace in path name, like "Program Files" problem, try installing to a directory with no spaces.

How does jboss server handles migrated .ear and .war files?

I am turning to SO here as my last resort, since my situation has been so illogical that I am at my wits end, even google can't get me a relatively close response.
I'll have to be very chronological. I am maintaining an application in Eclipse. The way application changes apply to the website is when I deploy appropriate .ear and .war files in the jboss test server.
I was relatively new to this whole process, so while learning on this, I stumbled upon occurrence I simply cannot logically comprehend.
1) I made some changes to the application (let's call it changeset_1
for convenience), created appropriate .ear and .war files, deployed
them to the jboss server.
2) Website was returning error 500. No biggie, I thought, let's deploy working files back to server. It returned the same error as if I
didn't deploy originals at all.
3) Restarting jboss server did not accomplish anything.
4) Frustrated, I thought of creating alternate files from the latest deployment directory. So I stored working project directory in the folder neighboring workspace folder used by eclipse. Then I started a new instance of Eclipse, and name new folder as a main namespase (old instance still uses old namespace folder).
5) In a new instance, I did not do any changes, I was just following
the same steps as before to create appropriate .ear and .war files and
deployed them as is to the server.
Now here is an interesting part
After performing steps above, I went to the test site link, and what I saw was: All changes from changeset_1 which I made originally in the first step successfully applied! At the same time, my last deployment was completely ignored.
Can anyone please point me in the right direction on how to approach such situation? Do I miss some kind of fundamental understanding on how all this stuff operates?
I literally don't have any more place to turn to... Unless I could not comprehend such incident to the point I could not explain it properly to google and it was giving me wrong results. Any help is really appreciated!
PS: I will do my best to provide any additional details if needed.
IMPORTANT EDIT
I initially thought I might've missed or misunderstood something, so I have recreated the scenario above for the second time. And for the second time I got the same outcome. Which no longer makes it an accident, but persistent occurrence.
EDIT 2
Upon request, here is a full error log in log file
2016-10-20 08:11:34,492 WARN
[org.jboss.detailed.classloader.ClassLoaderManager] (http-0.0.0.0-8080-1)
Unexpected error during load of:gov.ca.chp.cvs.struts.forms.CVSForm
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)
at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:150)
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)
at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.apache.struts.config.FormBeanConfig.formBeanClass(FormBeanConfig.java:358)
at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)
2016-10-20 08:11:34,492 WARN
[org.jboss.detailed.classloader.ClassLoaderManager]
(http-0.0.0.0-8080-1) Unexpected error during load of:gov.ca.chp.cvs.struts.forms.CVSForm
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
Rootcause: "java.lang.UnsupportedClassVersionError: Bad version number in .class file" comes when you compile a Java class in higher version of Java Compiler and run it on lower version of JRE.
Read more: http://javarevisited.blogspot.com/2011/12/bad-version-number-in-class-files-cause.html#ixzz4NjV9ORkF

JBoss: Deployment fails with ClassNotFoundException even though the class is there - JaxrsScanningProcessor

I have a WAR file with REST services. It deploys just fine on JBoss EAP 6.2 (corresponding to AS 7.something) in the standalone mode but it fails sometimes - but often - in the domain mode with a ClassNotFoundException for my subclass of the the JAX-RS Application class, even though it is in the war (well, it runs in standalone). Since it sometimes works, I suspect there is some concurrency issue that leads to JBoss trying to load the class before it can see it.
This is the error:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start
service jboss.deployment.unit.myapp.POST_MODULE: org.jboss.msc.service.StartException in
service jboss.deployment.unit.myapp.POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "myapp"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127)
...
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011230: Could not load JAX-RS Application class
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:218)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:100)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120)
[jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
... 5 more
Caused by: java.lang.ClassNotFoundException: myapp.rs.RestApplication from [Module "deployment.myapp:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
[jboss-modules.jar:1.3.0.Final-redhat-2]
...
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:214)
... 7 more
The class is there:
[jboss/domain]$ unzip -l data/content/6c/0ffc675ff1c2254540b6e8caffc0d2605ed549/content | grep RestApp
2262 02-13-14 09:05 WEB-INF/classes/myapp/rs/RestApplication.class
This is how I deployed it (my user != the user running jboss, if that makes a difference):
me$ /opt/jboss/bin/jboss-cli.sh -c --controller=0.0.0.0:49999 --user=admin --password=***
[domain#0.0.0.0:49999 /] deploy /vagrant/myapp.war --all-server-groups
The deployment fails in the same way when executed via the web Admin Console. The deployment to standalone is done by copying the .war to the standalone/deployments/ directory.
Any tips?
Config info
JBoss EAP 6.2
Rest Easy 3.0.6 (replacing the default 2.x module)
We have no JAX-RS stuff in web.xml aside of the resteasy.servlet.mapping.prefix context param; we use the resteasy-servlet-initializer library instead of manually configuring a servlet or similar thing in there
It seems I have fixed the problem by removing all resteasy/jaxrs/jboss libraries from the WAR file's WEB-INF/lib/.
I have noticed the war contained many libraries it should not, such as resteasy-jaxrs-3.0.6.Final.jar, jboss-jaxr-api_1.0_spec-1.0.0.Final.jar (which, BTW, conflicts with Rest Easy 3.0.6), javax.servlet-api-3.1.0.jar etc.
So I guess the classloader did not see/find the class because of classpath hell, the server and the webapp using different "instances" of the same libraries. (No idea why it worked under JBoss standalone; but standalone has the out-of-the-box configuration while domain has been adjusted a lot).
I have also sometimes included --runtime-name=myapp in the deployment command, which seems to be wrong, I should have used --runtime-name=myapp.war (including the ending).
Even though the Author had found an answer for himself, I think it might be useful to post my situation in case other people come accross this issue and the authors solution doesn't work for them.
I had a similar issue where a class was also not found when run under a Redhat JBoss AS cartridge inside Openshift, even though it seemed unreasonable, but later I figured out that the war I was expecting to be deployed wasn't deployed, instead a different one was deployed.
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[HelloWorld]] (http--127.10.254.129-8080-1) Allocate exception for servlet HelloWorld: java.lang.ClassNotFoundException: com.company.app.HelloWorld from [Module "deployment.ROOT.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
So if there are possibilities, I would run a search of all war files which are expected to have that class, unzip them and search inside the contents to see whether they contain the needed compiled class. I really suggest trying to search for all possible wars. Also look for possible YOUR_WAR.war.deployed it is most likely going to be in the same folder as the war that is currently deployed.
In my case I had these wars:
./app-root/runtime/repo/deployments/ROOT.war
./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war.deployed
./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war
I was expecting the real one to be in ./app-root/runtime/repo/deployments/ROOT.war because that's where maven was creating it, but seems JBoss would later have to copy it to ./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war in my case it didn't do that itself, so therefore my updated war was never deployed, instead it always went to deploy the old one which was already in ./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war
Hope this helps somebody to get on the right track.

rJava error when running with Eclipse

I have installed R 3.0.1 and Eclipse Kepler. (I have installed StatE to run R-script through and Eclipse R-console with no problem.) However, I cannot seem to get a java program to run. I'm posting my issues to see if anyone else has encountered them or can help me understand what I'm doing wrong. After installing R, rJava (through R), and eclipse, I ran the RJavaEclipse Plugin from studytrials.com. Then I configured the paths to the appropriate libraries or .dll.
When I try to run the rtest.java file that comes with the rJava JRI, I get the following error:
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in java.library.path.
java.lang.UnsatisfiedLinkError: no jri in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
at rtest.main(rtest.java:61)
When I try to run via the run tab in eclipse -> run configurations -> R -> rtest, I get a pop-up warning that says:
R_HOME must be set or R properly installed (\Software\R-core\InstallPath registry entry must exist).
So, following the advice that so many on SO give, I tried to find the answer in the warning message.
I found the path information in Eclipse (and Windows) was pointing to the correct locations both in the library and in the R run configuration:
(C:\Users\csnyder\Documents\R\win-library\3.0\rJava\jri\x64;C:\Program Files\Java\jre7\bin\server;C:\Program Files\R\R-3.0.1\bin\x64)
These paths also match the windows environmental paths.
So, I'm at a loss. If anyone has any suggestions on what my issue might be, I would greatly appreciate it. Please comment if you require any additional information.
I had the exact same problem on Linux. In essence, this set up is not updating java.library.path properly and the linkage to the JRI jars fails. I started by printing the path to the console with:
System.out.println(System.getProperty("java.library.path"));
And got this:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
To guarantee that Eclipse updates java.library.path correctly at run time, the Native library location item must be set to the folder containing the JRI jars (/usr/local/lib/R/site-library/rJava/jri in my case):
Just select the item and click Edit... to change its value.
you can try to add the jri.dll(in your rJava/jri/x64 package) on the System environment variable path,like this:(sorry I cann't put the picture on it )
in that way ,then restart your IDE and just run your test.

Cannot access Tomcat from Eclipse in Ubuntu

I am having a problem accessing Tomcat from the browser if it was invoked from Eclipse, but it works fine if invoked from command prompt.
I have configured Eclipse to start Tomcat 5.5.23. It starts fine. If I try to connect to it at least to see the admin page using http://localhost:8081/ I get 404 error "The requested resource (/) is not available".
No logs are emitted in the logs folder which is very strange. If I invoke it from comman dprompt 9using startup.sh) I do get log files in logs. This is a new fresh install of Tomact from tomcat.apache.org.
The console on Eclipse doesn't show any activity when attempting to access Tomcat, just the normal start up or Tomcat.
I didn't have problem using and connecting to Tomcat in Eclipse on Windows platform before but I have absolutely no clue why it is failing to do so on Linux?
Any help will be appreciated.
In your eclipse Run Configurations of your server instance catalina.base will not be same as your actual catalina home.
Set it to your catalina.home and it should work fine.
Are you sure Eclipse is configured to start the tomcat installation you currently starting manually?
There might be 2 installations, one shipped with eclipse and one other installed seperatly.
If so, it would be no wonder the admin-interface isn't accessable since -iirc- the admin-panel has to be installed afterwards.
If I try to connect to it at least to see the admin page using http://localhost:8081/ I get 404 error "The requested resource (/) is not available".
I don't know if this is the problem but 1. that's not the path of the admin application 2. it is actually not bundled with Tomcat 5.5. From the FAQ:
How do I install the Administration web app?
If you install Tomcat 5.5 binaries,
the Administration web app is not
bundled with it; this describes how to
add the Administration web app to your
Tomcat 5.5 installation. (Tomcat 4.1
comes with the Administration web app
as part of the binary).
The following refers to a Tomcat 5.5
set up on Windows 2000, so your path
names will be different on *nix
platforms. In this example, Tomcat
5.5.17 in installed in c:\Program Files\Apache Software
Foundation\Tomcat 5.5 (this is my
CATALINA_HOME).
Unzip or untar (be careful to use GNU tar) the file containing the
administration web app files (eg.
apache-tomcat-5.5.17-admin.zip) to a
temporary directory, eg. c:\temp.
Copy c:\temp\apache-tomcat-5.5.17\conf\Catalina\localhost\admin.xml to the directory c:\Program
Files\Apache Software
Foundation\Tomcat
5.5\conf\Catalina\localhost.
Copy the entire directory tree c:\temp\apache-tomcat-5.5.17\server\webapps\admin
to the directory c:\Program
Files\Apache Software
Foundation\Tomcat 5.5\server\webapps.
This is an overlay, so \server\webapps
is just pointing you to the
\server\webapps, and the admin
directory with its contents will be
the only thing you see added there.
Add a line to your c:\Program Files\Apache Software
Foundation\Tomcat
5.5\conf\tomcat-users.xml file so that you have a user who has admin
role. For example, add this line just
before the last line (containing
</tomcat-users>) of the file:
<user username="admin" password="makesomethingup" roles="admin,manager"/>
Restart Tomcat.
Now when you visit http://localhost:8080/admin you should
see a page that asks for a user name
and password. If you still see the "no
longer loaded" error message in your
browser, you must either force a full
reload of the web page (in Firefox,
hold down Shift key while clicking on
the Reload button) or just restart
your browser completely.