由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - tomcat7部署war,jar写权限无法获得
相关主题
tomcat 访问硬盘文件的问题, 3xHashMap cache
Sun's Java Tutorial problem: failed to load appletRe: Desperately need help on DB2 connection through jdbc in jsp page
请问StringBuffer的OutofMemory问题Run Servlet with Tomcat
MidiUnavailableException: No driverj2ee启动时, 启动了tomcat吗?
Concurrent Exception in Swing[转载] Urgent Help needed about Java Servlet?
一个关于继承的问题请问JSP里这个怎么设
如何定义近似值并进行相应的计算JSP/SERVLET里面如何实现弹出窗口(新短信)功能
请教一个多线程lock机制的问题tomcat作server,jsp访问的文件必须在webapps/ROOT/?
相关话题的讨论汇总
话题: source话题: unknown话题: tomcat7话题: file话题: user
进入Java版参与讨论
1 (共1页)
y****e
发帖数: 1012
1
接手了一个别人的项目,目前功能部分已经调通了,现在前端部署遇到了一些问题。前
端才用zk,zk里面嵌入一些java code。
整个page,data打包成DCL.war,我把它拷贝到/var/lib/tomcat7/webapps/下面,chmod
to 755, chown to tomcat7:tomcat7.运行localhost:8080/DCL/解压,页面正常显示~
但是运行提交页面的时候出现java.io.FileNotFoundException: cache.csv (Permissi
on denied)
这个cache.csv.是从我的某个jar写出来的,我改了相应目录的权限好像还是不行,我在
‘/etc/tomcat7/policy.d/03catalina.policy’加入了写权限:
grant codeBase "file:${catalina.base}/webapps/DCL.war" {
permission java.security.AllPermission;
permission java.io.FilePermission "file:${catalina.base}/webapps/DCL/-", "
read, write";
}
grant {
permission java.io.FilePermission "file:${catalina.base}/webapps/DCL/WEB-I
NF/lib/-", "read, write";
}
好像还是,不知道问题出在哪里。
大家帮忙看看哈~~
谢谢!
g*****g
发帖数: 34805
2
Usually this is about the user that starts the tomcat. That user needs
to have write priviledge to that directory.

chmod
示~
Permissi
我在

【在 y****e 的大作中提到】
: 接手了一个别人的项目,目前功能部分已经调通了,现在前端部署遇到了一些问题。前
: 端才用zk,zk里面嵌入一些java code。
: 整个page,data打包成DCL.war,我把它拷贝到/var/lib/tomcat7/webapps/下面,chmod
: to 755, chown to tomcat7:tomcat7.运行localhost:8080/DCL/解压,页面正常显示~
: 但是运行提交页面的时候出现java.io.FileNotFoundException: cache.csv (Permissi
: on denied)
: 这个cache.csv.是从我的某个jar写出来的,我改了相应目录的权限好像还是不行,我在
: ‘/etc/tomcat7/policy.d/03catalina.policy’加入了写权限:
: grant codeBase "file:${catalina.base}/webapps/DCL.war" {
: permission java.security.AllPermission;

y****e
发帖数: 1012
3
tomcat7 is started when first boot up. Is it root or my account or tomcat7
user. My account has admin priviledge that allows writes. I change owner of
the DCL.war to tomcat7. Is this right?
Many thanks.

【在 g*****g 的大作中提到】
: Usually this is about the user that starts the tomcat. That user needs
: to have write priviledge to that directory.
:
: chmod
: 示~
: Permissi
: 我在

e*****t
发帖数: 1005
4
先chmod 777,看看能不能解决问题

chmod
示~
Permissi
我在

【在 y****e 的大作中提到】
: 接手了一个别人的项目,目前功能部分已经调通了,现在前端部署遇到了一些问题。前
: 端才用zk,zk里面嵌入一些java code。
: 整个page,data打包成DCL.war,我把它拷贝到/var/lib/tomcat7/webapps/下面,chmod
: to 755, chown to tomcat7:tomcat7.运行localhost:8080/DCL/解压,页面正常显示~
: 但是运行提交页面的时候出现java.io.FileNotFoundException: cache.csv (Permissi
: on denied)
: 这个cache.csv.是从我的某个jar写出来的,我改了相应目录的权限好像还是不行,我在
: ‘/etc/tomcat7/policy.d/03catalina.policy’加入了写权限:
: grant codeBase "file:${catalina.base}/webapps/DCL.war" {
: permission java.security.AllPermission;

r*****l
发帖数: 2859
5
Tomcat should use “jsvc” to start itself as a service. "jsvc" has a
command line parameter "--user". Most probably that user is set to tomcat.
Check the init file, in /etc/init.d if you use RHEL.

of

【在 y****e 的大作中提到】
: tomcat7 is started when first boot up. Is it root or my account or tomcat7
: user. My account has admin priviledge that allows writes. I change owner of
: the DCL.war to tomcat7. Is this right?
: Many thanks.

y****e
发帖数: 1012
6
I changed everything tomcat7 possibly can touch to 777. Looks like it's not
working.

【在 e*****t 的大作中提到】
: 先chmod 777,看看能不能解决问题
:
: chmod
: 示~
: Permissi
: 我在

y****e
发帖数: 1012
7
I checked /etc/init.d/tomcat7. --user was followed by TOMCAT7_USER, TOMCAT7_
USER=tomcat7. What else I need to check? I can provide more information if
needed.

【在 r*****l 的大作中提到】
: Tomcat should use “jsvc” to start itself as a service. "jsvc" has a
: command line parameter "--user". Most probably that user is set to tomcat.
: Check the init file, in /etc/init.d if you use RHEL.
:
: of

r*****l
发帖数: 2859
8
That means user "tomcat7" is running tomcat. After it's running, you can run
this command to confirm:
ps -ef|grep tomcat
As goodbug said, just give tomcat7 the right permission to the file/dir.

TOMCAT7_

【在 y****e 的大作中提到】
: I checked /etc/init.d/tomcat7. --user was followed by TOMCAT7_USER, TOMCAT7_
: USER=tomcat7. What else I need to check? I can provide more information if
: needed.

g*****g
发帖数: 34805
9
You should show the full exception stack, maybe there's something
else. You should give the user the priviledge to the folder you want
to write, the war file doesn't count.
Sometimes you get permission denied in writing because the
folder doesn't exist.

TOMCAT7_

【在 y****e 的大作中提到】
: I checked /etc/init.d/tomcat7. --user was followed by TOMCAT7_USER, TOMCAT7_
: USER=tomcat7. What else I need to check? I can provide more information if
: needed.

y****e
发帖数: 1012
10
ava.io.FileNotFoundException: cache.csv (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:212)
at java.io.FileWriter.(FileWriter.java:107)
at edu.uiuc.cs.datacenterplacement.location.DataCache.addValue(
DataCache.java:98)
at edu.uiuc.cs.datacenterplacement.location.CoordinatesManager.
searchLocationPostalCode(CoordinatesManager.java:73)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeStaticMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHVariableDeclarator.eval(Unknown Source)
at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHForStatement.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHForStatement.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.Name.invokeLocalMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
I change the permission/owner of the folder and file, I can provide further
info if needed.
I don't know where did the code write to 'cache.csv'. Do you think a redo of
war file will help? BTW, how do I generate war file correctly(with
configuration, every setting right)?
Many thanks!

【在 g*****g 的大作中提到】
: You should show the full exception stack, maybe there's something
: else. You should give the user the priviledge to the folder you want
: to write, the war file doesn't count.
: Sometimes you get permission denied in writing because the
: folder doesn't exist.
:
: TOMCAT7_

相关主题
一个关于继承的问题HashMap cache
如何定义近似值并进行相应的计算Re: Desperately need help on DB2 connection through jdbc in jsp page
请教一个多线程lock机制的问题Run Servlet with Tomcat
进入Java版参与讨论
y****e
发帖数: 1012
11
tomcat7 2888 1 2 20:26 ? 00:00:19 /usr/lib/jvm/jdk1.7.0_03/bin
/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.
properties -Djava.library.path=/ssd_back/workspace/CDPlacement/
DCPlacementCore/lib -Djava.awt.headless=true -Xmx128m -XX:+
UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.
ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -
classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat
-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/
tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.
startup.Bootstrap start

run

【在 r*****l 的大作中提到】
: That means user "tomcat7" is running tomcat. After it's running, you can run
: this command to confirm:
: ps -ef|grep tomcat
: As goodbug said, just give tomcat7 the right permission to the file/dir.
:
: TOMCAT7_

T****U
发帖数: 3344
12
edu.uiuc.cs.datacenterplacement.location.DataCache.addValue(
DataCache.java:98)
maybe the project was developed on windows platform and save the file to an
external location. check the above source and see if you can find the proble
m.

【在 y****e 的大作中提到】
: ava.io.FileNotFoundException: cache.csv (Permission denied)
: at java.io.FileOutputStream.open(Native Method)
: at java.io.FileOutputStream.(FileOutputStream.java:212)
: at java.io.FileWriter.(FileWriter.java:107)
: at edu.uiuc.cs.datacenterplacement.location.DataCache.addValue(
: DataCache.java:98)
: at edu.uiuc.cs.datacenterplacement.location.CoordinatesManager.
: searchLocationPostalCode(CoordinatesManager.java:73)
: at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
: at sun.reflect.DelegatingMethodAccessorImpl.invoke(

y****e
发帖数: 1012
13
cache.csv was created in class DataCache.
public class DataCache {
private static final String FILENAME = "cache.csv";
private static final double TOLERANCE = 0.1;
private static List memCacheCoord = new ArrayList<
Coordinate>()
;
private static List memCacheConte = new ArrayList();
.....
public static void addValue(double lat, double lng, Object data) {
try {
DecimalFormat format = new DecimalFormat("####.##");
String line = format.format(lat)+";"+format.format(
lng)+";"+toString(data
)+"\n";
// Store in file
FileWriter writer = new FileWriter(new File(FILENAME
), true);
writer.write(line);
writer.flush();
writer.close();
// Store in memory
memCacheCoord.add(new Coordinate(lat, lng));
memCacheConte.add(line);
} catch (IOException e1) {
e1.printStackTrace();
}
}
.....
};
I am not sure where exactly cache.csv was written to.

an
proble

【在 T****U 的大作中提到】
: edu.uiuc.cs.datacenterplacement.location.DataCache.addValue(
: DataCache.java:98)
: maybe the project was developed on windows platform and save the file to an
: external location. check the above source and see if you can find the proble
: m.

g*****g
发帖数: 34805
14
You need to find out where this path is. Use
File.getAbsolutePath() to determine that. My guess is this
pointing to a shared tomcat directory that's not writtable, not
the app home directory.
Or you may append a temp directory before the hardcoded filename.
System.getProperty("java.io.tmpdir"));

);

【在 y****e 的大作中提到】
: cache.csv was created in class DataCache.
: public class DataCache {
: private static final String FILENAME = "cache.csv";
: private static final double TOLERANCE = 0.1;
: private static List memCacheCoord = new ArrayList<
: Coordinate>()
: ;
: private static List memCacheConte = new ArrayList();
: .....
: public static void addValue(double lat, double lng, Object data) {

T****U
发帖数: 3344
15
check if you can create a file "cache.csv" at where the application is deplo
yed. chmod it to 777, and then try running your program again.

);

【在 y****e 的大作中提到】
: cache.csv was created in class DataCache.
: public class DataCache {
: private static final String FILENAME = "cache.csv";
: private static final double TOLERANCE = 0.1;
: private static List memCacheCoord = new ArrayList<
: Coordinate>()
: ;
: private static List memCacheConte = new ArrayList();
: .....
: public static void addValue(double lat, double lng, Object data) {

y****e
发帖数: 1012
16
Looks like there is still problems when packing the war files. When I made
changes, the changes didn't reflected on the war files. Wierd. I will check
it out.

【在 g*****g 的大作中提到】
: You need to find out where this path is. Use
: File.getAbsolutePath() to determine that. My guess is this
: pointing to a shared tomcat directory that's not writtable, not
: the app home directory.
: Or you may append a temp directory before the hardcoded filename.
: System.getProperty("java.io.tmpdir"));
:
: );

y****e
发帖数: 1012
17
I will try.

deplo

【在 T****U 的大作中提到】
: check if you can create a file "cache.csv" at where the application is deplo
: yed. chmod it to 777, and then try running your program again.
:
: );

y****e
发帖数: 1012
18
I fixed it using some quick and dirty tricks. I hard-code from 'cache.csv' t
o '/tmp/cache.csv'. Now it works fine.
But I still have problems generating the war file, I just replace the jar fi
le inside the deployed directory. Is there any book on how to manage large s
cale java code? Debuging using Eclipse and packing using maven is really tri
cky to me.
Thanks all

【在 g*****g 的大作中提到】
: You need to find out where this path is. Use
: File.getAbsolutePath() to determine that. My guess is this
: pointing to a shared tomcat directory that's not writtable, not
: the app home directory.
: Or you may append a temp directory before the hardcoded filename.
: System.getProperty("java.io.tmpdir"));
:
: );

m****r
发帖数: 6639
19
what i found to be the easiest way for me is to generate a stub war maven
project, and use the eclipse plug in to generate the project file for
eclipse.

t
fi
s
tri

【在 y****e 的大作中提到】
: I fixed it using some quick and dirty tricks. I hard-code from 'cache.csv' t
: o '/tmp/cache.csv'. Now it works fine.
: But I still have problems generating the war file, I just replace the jar fi
: le inside the deployed directory. Is there any book on how to manage large s
: cale java code? Debuging using Eclipse and packing using maven is really tri
: cky to me.
: Thanks all

s******e
发帖数: 493
20
It is tricky to package, debug, and deploy a large scale (many times, they
are modulized) web app in eclipse.
My experience is:
1. find one complete maven book
2. google some maven project samples.
3. pay attention to plugins.

t
fi
s
tri

【在 y****e 的大作中提到】
: I fixed it using some quick and dirty tricks. I hard-code from 'cache.csv' t
: o '/tmp/cache.csv'. Now it works fine.
: But I still have problems generating the war file, I just replace the jar fi
: le inside the deployed directory. Is there any book on how to manage large s
: cale java code? Debuging using Eclipse and packing using maven is really tri
: cky to me.
: Thanks all

1 (共1页)
进入Java版参与讨论
相关主题
tomcat作server,jsp访问的文件必须在webapps/ROOT/?Concurrent Exception in Swing
Re: tomcat作server,jsp访问的文件必须在webapps/ROO一个关于继承的问题
大家愿意讨论一下log4j么如何定义近似值并进行相应的计算
多个Log4J配置文件问题请教一个多线程lock机制的问题
tomcat 访问硬盘文件的问题, 3xHashMap cache
Sun's Java Tutorial problem: failed to load appletRe: Desperately need help on DB2 connection through jdbc in jsp page
请问StringBuffer的OutofMemory问题Run Servlet with Tomcat
MidiUnavailableException: No driverj2ee启动时, 启动了tomcat吗?
相关话题的讨论汇总
话题: source话题: unknown话题: tomcat7话题: file话题: user