Tomcat7 running on windows - windows

I have a folder with Tomcat7 installed on my disk that I use to do some tests on my web application running it from eclipse and it I works well. When I try to deploy the application on a stand alone tomcat server it gives an error: (I'm using windows)
Fev 08, 2012 9:10:04 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet Process
java.lang.NullPointerException
at hs.server.CommandFactory.<init>(CommandFactory.java:27)
at hs.server.Process.init(Process.java:40)
and the line 27 is in this context:
19-String pathname = "/"+packageName.replace(".", "/")+"/";
20 //String pathname = packageName.replace(".", "/");
21- URL resource = loader.getResource(pathname);
22- File commandDir = (new File(resource.getFile()));
23-
24- //File commandDir = new File(loader.getResource(packageName.replace(".", 25-"/")).getFile());
26-
27- for(String classFilepath: commandDir.list()) {
I guess is something about the URL but the problem is that I'm running it without any problems on the tomcat instance on eclipse. Thank you

File.list() will return null if File represents a non-existent directory. This null will then cause your for loop to throw a null-pointer exception.
You need to make your code defensive, and check that the directory exists using the methods on File before you attempt to read it.

Related

Resource location must not be null

I am using intellij and here are my settings when running a java program:
Working directory: c:/Users/myuser/configuration/properties
VM optiions: -Dserver.ssl.trust-store=config/keystore.jks - Dserver.ssl.trust-store-password=changeit
My directory structure is:
.. /configuration/properties/config/keystore.jks
But I keep on getting Resource must not be null error. How shoukd I set the vm options properly? I tried using full path and "file:/" but same error

Writing files to a user directory temporary folder using Java in Websphere 9

I have an application which has multipart file attachment module. In this, I have created a logic which writes the files to the local application server(Tomcat in my case) temp folder and gets deleted once it has been uploaded.
I used this logic for creating files,
File tmpFile = new File(System.getProperty("user.install.root") + File.separator + file.getOriginalFilename());
file.transferTo(tmpFile);
This works as expected in Tomcat, but deploying the same in Websphere 9 environment, throws the below exception,
[11/13/17 20:20:45:946 IST] 000000f2 SystemErr R Caused by:
java.io.FileNotFoundException: C:\Program
Files\IBM\WebSphere\AppServer_1\profiles\AppSrv01\temp\WIN7VSNode04\server1\project name\project name.war\null\tmpfiles\uploaded file.extension
(The system cannot find the path specified.)
What might be the issue here?
Thanks in advance.
A variable is null when you're concatenating the path:
...\project name.war\null\tmpfiles\...
^^^^
Fix that and it should probably work.

AdminTask.listTCPEndPoints('abc(abc)') throws exception: ADMF0007E: target object is required

I'm working on deploying application to WebSphere 7 using python script and the script is throwing exception at this line:-
AdminTask.listTCPEndPoints('abc(abc)')
If I run the above command before I run the python script, it works fine. It gives me an error ADMF0003E: Invalid parameter value. But the same command fails in the python script with this error:
wsadmin>AdminTask.listTCPEndPoints('abc(abc)')
WASX7015E: Exception running command: "AdminTask.listTCPEndPoints('abc(abc)')"; exception information: com.ibm.websphere.management.cmdframework.CommandValidationException: ADMF0007E: target object is required.
I can guess that there something in the python script that is causing this issue, but I don't understand why is the AdminTask.listTCPEndPoints command is not able to see the parameter being passed. I'm new to WebSphere, I have only used it in past but never configured it. Any help/insight would be highly appreciated.
Thanks!
Added stack trace of interactive mode option
wsadmin>print AdminTask.listTCPEndPoints('-interactive')
List NamedEndPoints that can be used by a TCPInboundChannel
Lists all NamedEndPoints that can be associated with a TCPInboundChannel
*TCPInboundChannel: abc(abc)
excludeDistinguished (excludeDistinguished): 0
WASX7435W: Value 0 is converted to a boolean value of false.
unusedOnly (unusedOnly): 0
WASX7435W: Value 0 is converted to a boolean value of false.
List NamedEndPoints that can be used by a TCPInboundChannel
F (Finish)
C (Cancel)
Select [F, C]: [F] F
WASX7278I: Generated command line: AdminTask.listTCPEndPoints('[-excludeDistinguished false -unusedOnly false]')
WASX7015E: Exception running command: "AdminTask.listTCPEndPoints('-interactive')"; exception information:
com.ibm.websphere.management.cmdframework.CommandValidationException: ADMF0007E: target object is required.
Follow this link. It appears that you have not specified the target object that's why that error is coming.
I suggest use the following command as a starter
print AdminTask.listTCPEndPoints('-interactive')
Note: Instead of copying and pasting the command, type it on the command line. sometimes command editor does not take the command after pasting it directly.
Okay, I was able to fix the error. I was getting that error because as part of the application deployment script, I was copying few of my application jars to WebSphere's java/jre/lib/ext directory so that those are available in classpath. In one of those jar, I had bundled an IBM class (Base64Coder.class) which was required by a class in my jar and it was corrupting the WebSphere AdminTask utility. When I removed that Base64Coder.class from my jar, python script worked fine. I believe, the reason it corrupted WebSphere was that there was a duplication of the same class in the JVM as the class comes with IBM WebSphere installation and was present in AppServer/runtimes/com.ibm.ws.webservices.thinclient_7.0.0.jar

karaf 3.0.1 not starting up

I'm trying to start karaf 3.0.1 in a solaris box (without internet) but getting the following error:
karaf: Ignoring predefined value for KARAF_HOME
Could not resolve mvn:org.eclipse/org.eclipse.osgi/3.8.2.v20130124-134944
and in karaf.log:
Jun 30, 2014 12:21:09 PM org.apache.karaf.main.Main main
SEVERE: Could not launch framework
java.lang.RuntimeException: Could not resolve mvn:org.eclipse/org.eclipse.osgi/3.8.2.v20130124-134944
at org.apache.karaf.main.util.SimpleMavenResolver.resolve(SimpleMavenResolver.java:59)
at org.apache.karaf.main.Main.createClassLoader(Main.java:315)
at org.apache.karaf.main.Main.launch(Main.java:234)
at org.apache.karaf.main.Main.main(Main.java:171)
the bundles are well in place (system folder) and the org.ops4j.pax.url.mvn.cfg file states:
org.ops4j.pax.url.mvn.repositories=\
file:${karaf.home}/${karaf.default.repository}#id=system.repository, \
file:${karaf.data}/kar#id=kar.repository#multi\
http://repo1.maven.org/maven2#id=central,\
http://repository.springsource.com/maven/bundles/release#id=spring.ebr.release,\
http://repository.springsource.com/maven/bundles/external#id=spring.ebr.external
I've tried running the framework using the three methods (server, service, client) but nothing seems to be working.
my environment is:
KARAF_BASE=/export/home/mehdi/bin/karaf
KARAF_HOME=/export/home/mehdi/bin/karaf
KARAF_ETC=/export/home/mehdi/bin/karaf/etc
KARAF_DATA=/export/home/mehdi/bin/karaf/data
JAVA_HOME=/opt/temp/jre1.7.0_13
I googled a bit and found a workaround which says to add -h 127.0.0.1 to the client script, but still nothing.

How to configure xuggle for Apache Tomcat in Windows

I have been developing a video sharing web application (like youtube) using Netbeans with Tomcat on Windows platform. There I want to generate thumbnail images of video files as soon as the videos get uploaded. So searching the net I found something called Xuggle. I installed Xuggler in my Tomcat's lib folder. I have set the necessary environment variables. When I run just a java application I get the results, but when I do the same with a Java web application I get the following errors:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause
java.lang.UnsatisfiedLinkError: com.xuggle.xuggler.XugglerJNI.Global_NO_PTS_get()J
com.xuggle.xuggler.XugglerJNI.Global_NO_PTS_get(Native Method)
com.xuggle.xuggler.Global.<clinit>(Global.java:240)
xugglerPack.Main.<clinit>(Main.java:43)
xugglerPack.VT.processRequest(VT.java:86)
xugglerPack.VT.doPost(VT.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:3
93)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26
logs.
===========================================================================================
#pd40 >>> I reinstalled Xuggler ( this time in C:\Program Files , I restarted my PC after installation . I set the following in my environment variables :
XUGGLE_HOME = C:\Program Files (x86)\Xuggle
CLASSPATH = .;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\commons-cli.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\logback-classic.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\logback-core.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\slf4j-api.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\xuggle-xuggler.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\xuggle-xuggler-test.jar;
PATH = C:\Program Files (x86)\Xuggle\bin;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\bin;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib;C:\Program Files (x86)\Xuggle\lib
I have copied the jars of Xuggle/java/jars (6 jar files) in The Tomcat's\lib folder and set the CLASSPATH of them.
Now I still get the problem when i do this in a web application , but standalone java application generates the images nicely. What is going wrong ??? When i upload a video it gets uploaded but the thumbnail images are not generated , I get the following error...
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: Could not initialize class com.xuggle.ferry.FerryJNI
com.xuggle.ferry.RefCounted.acquire(RefCounted.java:179)
com.xuggle.xuggler.IContainer.copyReference(IContainer.java:80)
com.xuggle.mediatool.AMediaCoderMixin.<init>(AMediaCoderMixin.java:68)
com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137)
com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
xugglerPack.Main.main(Main.java:51)
xugglerPack.VT.processRequest(VT.java:87)
xugglerPack.VT.doPost(VT.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26
logs.
Make sure you put Xuggler lib in your windows PATH or LD_LIBRARY_PATH.
Similar to Tomcat native. I assume you have tried this.
You might also want to check out this thread

Resources