Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Gravity Pike
Feb 8, 2009

I find this discussion incredibly bland and disinteresting.

horse_ebookmarklet posted:

I'm confused about CancelledKeyExceptions and a SelectionKey when using NIO Selectors.
I have a situation where an underlying socket channel may be closed by any thread. In a thread separate from where a channel is cancelled, I am calling select() with channels that are registered with OP_READ.
Occasionally I get a CancelledKeyException when I test isReadable(). Clearly another thread is closing a socket channel after select() has returned but before I test isReadable().

I believe my best course of action is to catch a CancelledKeyException. My only concern is that this is an unchecked runtime exception, which would seem to indicate a unrecoverable condition or programming error on my part...
Some references on stack overflow suggest testing isValid() && isReadable(), but this has an obvious time-of-check-time-of-use error.

Other than catching an unchecked exception, I do not understand how else to detect and recover from this condition.

An unchecked exception is the library's designer indicating that they don't expect you to want to, or know how to, recover from this error. (IMO, IOException really ought to be a RuntimeException.) You don't need to feel bad about catching RuntimeExceptions if you know what they indicate, and how to recover. You should be extremely careful catching Throwables, because there are very, very few situations where you can reasonably recover from an Error, but any exception thrown is just the library designer communicating information upwards.

I'm not familiar with your specific application, but, er, why do many threads need access to the same channel, with any of them capable of closing it? If at all possible, I would personally prefer to refactor the code so that there's only one reference to the channel inside of a wrapper class that maybe exposes something a little more high-level than pushing and pulling bytes. I'd add synchronization logic within that class to ensure that my channel is readable before I read from it - since the reads are all happening within one class, it's much easier to ensure that everyone is following the same synchronization rules.

If what you're trying to implement here is basically a Queue, with a bunch of worker threads taking the same type of information out of the channel as quickly as it's available, I'd look into using Guava's thread-safe Queues here; you'd have one thread that pulls information out of the channel as it becomes available and puts it into the queue, and then N worker-threads each pulling information out of the queue. You're doing all of the unsafe work within one thread, and then leveraging Google's experience at writing thread-safe code to make sure that your worker threads never step on each other's toes.

Adbot
ADBOT LOVES YOU

Brain Candy
May 18, 2006


Nothing returned by Queues isn't in the standard java library.

Brain Candy
May 18, 2006

horse_ebookmarklet posted:

I'm confused about CancelledKeyExceptions and a SelectionKey when using NIO Selectors.
I have a situation where an underlying socket channel may be closed by any thread. In a thread separate from where a channel is cancelled, I am calling select() with channels that are registered with OP_READ.
Occasionally I get a CancelledKeyException when I test isReadable(). Clearly another thread is closing a socket channel after select() has returned but before I test isReadable().

I believe my best course of action is to catch a CancelledKeyException. My only concern is that this is an unchecked runtime exception, which would seem to indicate a unrecoverable condition or programming error on my part...
Some references on stack overflow suggest testing isValid() && isReadable(), but this has an obvious time-of-check-time-of-use error.

Other than catching an unchecked exception, I do not understand how else to detect and recover from this condition.

Queues are a good answer here; put the socket close on the selection thread by adding an operation queue.

horse_ebookmarklet
Oct 6, 2003

can I play too?
As a stop gap I am catching and recovering from the RuntimeException. It seeeeems to work.

The application architecture currently has a thread where the selector parses tasks (Over TCP) and submits the tasks to a queue, and a number of workers in a pool poll for these tasks. Similar to the architecture suggested.

The tasks are computations that are sent back to the client that requested it. When the task is complete the worker attempts to write the result back to the TCP socket. A client can submit multiple tasks to be computed simultaneously, so multiple workers can write back. I have a wrapper around the SocketChannel that handles synchronization and currently closes the socket channel if something unexpected happens (write() failure or application specific event in the worker).

It sounds like it would be better design to signal the selector thread to close the socket. Next time the selector returns, 'reap' any socket channels that have a 'close pending'.

Brain Candy
May 18, 2006

horse_ebookmarklet posted:

It sounds like it would be better design to signal the selector thread to close the socket. Next time the selector returns, 'reap' any socket channels that have a 'close pending'.

Yup. Do all the I/O touching on the selector thread and then you're not fighting the design.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Java EE/ EJB question:

Currently I have a very simple MDB example with a servlet using JMS to talk to a bean. The ConnectionFactory and Queue are specified using @Resource injection in both the servlet and the bean. For the bean:

code:
@Resource(name = "jms/qcf")
QueueConnectionFactory qcf;

@Resource(name = "jms/basic/replyQueue")
Queue replyQueue;
I'm trying to change these over to setting @ActivationConfigProperty like so
code:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "jms/qcf"),
@ActivationConfigProperty(propertyName = "destinationType ", propertyValue = "javax.jms.Queue "),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/basic/replyQueue"),
})
public class BasicMDB implements MessageListener {
    QueueConnectionFactory qcf;
    Queue replyQueue;

/* ... */
}
But in the simple example the reply that's supposed to come back never does. I'm really new to Java EE and EJB, can anyone see what I'm doing wrong?

Chas McGill
Oct 29, 2010

loves Fat Philippe
I'm trying to use the new LocalDate class in Java 8 and for some reason I'm getting an error in IntelliJ that its constructor is private, despite the javadoc listing it as public.

I expect I'm missing something fairly obvious here. I've imported the correct package. I just want a toString() friendly date format without any time information.

HFX
Nov 29, 2004

Chas McGill posted:

I'm trying to use the new LocalDate class in Java 8 and for some reason I'm getting an error in IntelliJ that its constructor is private, despite the javadoc listing it as public.

I expect I'm missing something fairly obvious here. I've imported the correct package. I just want a toString() friendly date format without any time information.

You linked the javadoc for Joda time. The LocalDate class in Java 8 has no public constructors and instead supplies statics methods to create a new local date.
http://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

HFX fucked around with this message at 15:13 on Sep 26, 2014

Chas McGill
Oct 29, 2010

loves Fat Philippe

HFX posted:

You linked the javadoc for Joda time. The LocalDate class in Java 8 has no public constructors and instead supplies statics methods to create a new local date.
http://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
That's what I get for googling something and looking at the first result without thinking about it! I think I was still thinking in terms of the old Date class, which does have a public constructor.

I got the result I wanted with this:
LocalDate dob = LocalDate.of(1950,10,14);

Chas McGill fucked around with this message at 15:17 on Sep 26, 2014

HFX
Nov 29, 2004

Chas McGill posted:

That's what I get for googling something and looking at the first result without thinking about it! I think I was still thinking in terms of the old Date class, which does have a public constructor.

I got the result I wanted with this:
LocalDate dob = LocalDate.of(1950,10,14);

It's okay. At least you get to play with cool features. Work just crushes me by forcing me to stay in the bounds of Java 6 if I'm lucky.

Chas McGill
Oct 29, 2010

loves Fat Philippe

HFX posted:

It's okay. At least you get to play with cool features. Work just crushes me by forcing me to stay in the bounds of Java 6 if I'm lucky.

Well, I just finished a couple of Java modules so this is just for a personal project to stop everything I learnt from leaking out of my brain now that they're over. I remember worrying that what I was being taught would be obsolete within a year, but that was before I understood how much legacy work there is.

HFX
Nov 29, 2004

Chas McGill posted:

Well, I just finished a couple of Java modules so this is just for a personal project to stop everything I learnt from leaking out of my brain now that they're over. I remember worrying that what I was being taught would be obsolete within a year, but that was before I understood how much legacy work there is.

Average large corporation development:

New version (Java 8): Can't use it. It isn't test it. What if all our crappy applications don't work.
Old version still supported for security (Java 7): Can't use it. What if our applications break. We will move there in 2-5 years.
Old version EOL'd (Java 6): This is our current standard. All projects including new projects should target this.

Don't worry. Average industry is almost always 10-15 years behind academia when it comes to software.

MrMoo
Sep 14, 2000

Oracle are happy to support any version of Java for a large bag of coin. There is a page somewhere, I recall it going back at least to version 1.3, this page has version 5 supported for eternity:

http://www.oracle.com/technetwork/java/javase/eol-135779.html

MrMoo fucked around with this message at 01:12 on Sep 27, 2014

DholmbladRU
May 4, 2006
Created a java application which uses axis to call some web services. One of my calls is returning this object and I am unsure how to parse it.


code:
     OMElement elm = hResult.getExtraElement().getFirstElement();
    		Iterator it  = elm.getChildrenWithLocalName("Table");
    		while(it.hasNext()){
    				System.out.println(it.next());
    				}
This system out prints some XML which I assume could be parsed. But I am unsure what the best approach to paring it out is.

System.out.println result

code:
    <Table xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" diffgr:id="Table1" msdata:rowOrder="0">
        <id>396</id><nb>0003296</nb><dub>HOME</dub>
        <id>397</id><nb>0003296</nb><dub>HOME</dub>
        <id>398</id><nb>0003296</nb><dub>HOME</dub>
        <id>399</id><nb>0003296</nb><dub>HOME</dub></table>
    ..
    ...
    .....
    ..
    <Table xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" diffgr:id="Table1" msdata:rowOrder="0">
        <id>396</id><nb>0003296</nb><dub>HOME</dub>
        <id>397</id><nb>0003296</nb><dub>HOME</dub>
        <id>398</id><nb>0003296</nb><dub>HOME</dub>
        <id>399</id><nb>0003296</nb><dub>HOME</dub></table>

What is the best way to parse out these elements?

Volguus
Mar 3, 2009
This looks like the toString method of that object is producing this XML. Since you're getting this from a webservice, and since it would be incredibly dumb to send an XML string over SOAP, most likely that element is a proper object (that may need casting) to be accessed nicely (call public methods, set/get/etc.).

Debug through it to see what kind of element is it (or just print getClass()).

If you really are getting an XML string over soap (I'd brush up the resume and get out of there asap), i guess all you have to do is parse said xml (jaxb is an easy way to do it and is integrated in the jdk, but there are bazillions of libraries to parse an xml out there).

DholmbladRU
May 4, 2006
The web service is from a client I am interfacing with.. And yes they are returning XML.

DholmbladRU fucked around with this message at 18:12 on Sep 29, 2014

Volguus
Mar 3, 2009

DholmbladRU posted:

The web service is from a client I am interfacing with.. And yes they are returning XML.

Then no wonder people are complaining that "SOAP is haaaaaard" since all they're using it for is to send strings (as XML) over the net, instead of objects. Well then, if you cannot beat them over the head with the knowledge bat, i guess you're stuck having to parse XML.

You can make it somewhat easier for you if you create the object model properly and then tell jaxb to parse the XML and store it in the object model (which is what the SOAP library would have done for free). The code would be something like:
code:
		JAXBContext jc = JAXBContext.newInstance(MyClass.class);
		Unmarshaller unmarshaller = jc.createUnmarshaller();
		MyClass obj = (MyClass) unmarshaller.unmarshal(new StringReader(
				xmlAsString));

DholmbladRU
May 4, 2006

Volguus posted:


code:

helpful code


Thanks! I ended up writing below which gets me to the elements I needed. But it looks slow..

code:
  StAXOMBuilder builder=(StAXOMBuilder)hResult.getExtraElement().getBuilder();
            OMElement serviceInfoElement = builder.getDocumentElement();
            Iterator it=serviceInfoElement.getChildren();           
            while(it.hasNext()){
            	OMElementImpl element=(OMElementImpl)it.next();
            	Iterator it1=element.getChildren();
            	while(it1.hasNext()){
            		OMElementImpl obj=(OMElementImpl)it1.next();
            		System.out.println("Obj Details >"+obj.getFirstChildWithName(new QName("FacilityID")));
            	}
            }

Volguus
Mar 3, 2009

DholmbladRU posted:

Thanks! I ended up writing below which gets me to the elements I needed. But it looks slow..

code:
...code

Hey, hold on a second. OMElement is part of the axiom package. Did you generate the webservice classes from the WSDL? Or are you answering client's call from a plain servlet?

DholmbladRU
May 4, 2006

Volguus posted:

Hey, hold on a second. OMElement is part of the axiom package. Did you generate the webservice classes from the WSDL? Or are you answering client's call from a plain servlet?

I generated the webservice classes from the wsdl and am leveraging them to make the WS call.

DholmbladRU fucked around with this message at 19:05 on Sep 29, 2014

pigdog
Apr 23, 2004

by Smythe
Seems to me you're doing something wrong. You shouldn't even be touching the DOM tree and manually parsing XML in order to use a webservice.

Volguus
Mar 3, 2009

DholmbladRU posted:

I generated the webservice classes from the wsdl and am leveraging them to make the WS call.

Ok, then why are you playing with the apache package? Should have something like (since you're the server apparently):

code:
 public Something thisIsRemoteMethodCall(MyClass params)
{
 //do something with params
  return something;
}

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
With Tomact 7, what's the difference between just dropping a war file into the webapps directory vs. using tomcat manager to deploy the war file?

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
So I recently started my CS degree with the Open University. Its meant to be part time but I have elected to study 3 modules at once, so its full time! My first modules are going well but I have been looking ahead and the course teaches 2 Java modules next semester. This wouldn't normally be an issue but I am studying them at the same time, so beginner and intermediate at the same time! I have some experience of Python but have never touched Java. What should I be looking at for online tutorials and stuff to give myself a fighting chance next semester.

HFX
Nov 29, 2004

thegasman2000 posted:

So I recently started my CS degree with the Open University. Its meant to be part time but I have elected to study 3 modules at once, so its full time! My first modules are going well but I have been looking ahead and the course teaches 2 Java modules next semester. This wouldn't normally be an issue but I am studying them at the same time, so beginner and intermediate at the same time! I have some experience of Python but have never touched Java. What should I be looking at for online tutorials and stuff to give myself a fighting chance next semester.

Are they teaching Java or concepts in Java? Can you give us a bit more information (course syllabus, module description, etc).

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

HFX posted:

Are they teaching Java or concepts in Java? Can you give us a bit more information (course syllabus, module description, etc).

The modules are:

Object-oriented Java programming (M250)
This module concentrates on aspects of Java that best demonstrate object-oriented principles and good practice, you'll gain a solid basis for further study of the Java language and object-oriented software development.

Software development with Java (M256)
Discover the fundamentals of an object-oriented approach to software development, using up-to-date analytical techniques and processes essential for specification, design and implementation.

HFX
Nov 29, 2004

thegasman2000 posted:

The modules are:

Object-oriented Java programming (M250)
This module concentrates on aspects of Java that best demonstrate object-oriented principles and good practice, you'll gain a solid basis for further study of the Java language and object-oriented software development.

Software development with Java (M256)
Discover the fundamentals of an object-oriented approach to software development, using up-to-date analytical techniques and processes essential for specification, design and implementation.

I will recommend these two places to start:

http://docs.oracle.com/javase/tutorial/java/TOC.html

https://thenewcircle.com/static/bookshelf/java_fundamentals_tutorial/index.html


The first class will probably be the basics of object oriented programming. The second one seems like it would be an extension of the first including teaching when to abstract, design patterns, etc. Both descriptions are sufficiently vague to tell you exactly what you can expect.

Chas McGill
Oct 29, 2010

loves Fat Philippe

thegasman2000 posted:

The modules are:

Object-oriented Java programming (M250)
This module concentrates on aspects of Java that best demonstrate object-oriented principles and good practice, you'll gain a solid basis for further study of the Java language and object-oriented software development.

Software development with Java (M256)
Discover the fundamentals of an object-oriented approach to software development, using up-to-date analytical techniques and processes essential for specification, design and implementation.

Mate, I just did those two modules. Don't worry too much about it. If you have any programming experience you'll be in a better position than I was to start with. M250 is baby's first java and M256 is jargon memorisation. Feel free to ask me any questions about the modules. I got a distinction for M250 and I'm anxiously waiting on the M256 results.

for (Frog eachFrog : frogTribe)
{
eachFrog.croak();
}

if (kermit.isGreen())
{
kermit.matingDance();
}

edit: Feels weird to see someone posting about the OU on here.

Chas McGill fucked around with this message at 23:55 on Sep 30, 2014

Volguus
Mar 3, 2009

fletcher posted:

With Tomact 7, what's the difference between just dropping a war file into the webapps directory vs. using tomcat manager to deploy the war file?

I don't think there are any differences. But you can probably more easily automate an app deployment using the manager application, rather than just scp it in there (from the build system for example).

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Hello Java friends - any chance there's an established pattern or something for this kind of thing?

I'm trying to make a superclass with some generic functionality, that can handle the specific details added by the subclasses. I want each subclass to be able to add some fields of various types, and pop them in a map pointing to their associated keys. Then the superclass will iterate over the map, grab each field variable, and call a method appropriate to its type. So something like:

Java code:
abstract class SuperButt {

  protected Map<Object, String> buttFieldsToKeys = new HashMap<Object, String>();

  public doThings() {
    for(Object buttField : buttFieldsToKeys.keySet()) {
      // get buttField's type and call the appropriate method
      // set buttField to some value as a result
    }
  }

}

class UseThisButt extends SuperButt {

  Integer numberOfButts;
  String  buttDescription;
  Double  buttFactor;
  
  public UseThisButt() {
    // add field references to buttFieldsToKeys
  }

  public doThings() {
    super();
    // fields are now populated and we can use them for nefarious purposes
  }

}
I guess I can use reflection to store a bunch of Field objects, and work with them, right? Is there a simple way to list the fields that I want to be mapped (i.e. not all of them) without having to use string versions of the names and worrying about typos and refactoring issues? Or is there a better way of approaching this?

Thom ZombieForm
Oct 29, 2010

I will eat you alive
I will eat you alive
I will eat you alive
For a Java classroom assignment, I created a superclass Employee, and Manager and Engineer classes inheriting from Employee.

I am trying to create an array of type Employee, and initialize some Managers and Engineers inside of it at the same time as declaring the array, but I can't figure out the syntax.

I know about

int [] a = {1,2,3,4,5}

but can't find an equivalent like

Employee [] a = {Engineer bob("bob","dobson"), Manager eric("eric", "ford")…}

How to do?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Progression Please posted:

For a Java classroom assignment, I created a superclass Employee, and Manager and Engineer classes inheriting from Employee.

I am trying to create an array of type Employee, and initialize some Managers and Engineers inside of it at the same time as declaring the array, but I can't figure out the syntax.

I know about

int [] a = {1,2,3,4,5}

but can't find an equivalent like

Employee [] a = {Engineer bob("bob","dobson"), Manager eric("eric", "ford")…}

How to do?

Employee[] a = new Employee[] {new Engineer("bob","dobson"), new Manager("eric", "ford")…}

iirc, on mobile.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Yeah you need to create each object in the array, which is what the new keyword does. It basically calls a constructor, so new Engineer("bob","dobson") is really calling the Engineer class's constructor with those two parameters, which does its business and creates the object, then new returns the reference.

So your array creation code sort of ends up like Employee[] a = { ref1, ref2 };
Like how int[] a = { 1+1, 2*5 }; will evaluate the stuff inside first and end up with int[] a = { 2, 10 };

TheresaJayne
Jul 1, 2011

thegasman2000 posted:

The modules are:

Object-oriented Java programming (M250)
This module concentrates on aspects of Java that best demonstrate object-oriented principles and good practice, you'll gain a solid basis for further study of the Java language and object-oriented software development.

Software development with Java (M256)
Discover the fundamentals of an object-oriented approach to software development, using up-to-date analytical techniques and processes essential for specification, design and implementation.

I started those at one time about 10 years ago, they started easy and then got mega hard even for a seasoned pro,
I hope you have lots of time as there was soooo much studying.

Although they keep saying that courses are being dumbed down.

TheresaJayne fucked around with this message at 07:22 on Oct 1, 2014

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Trying to setup SSL on Tomcat (APR):

code:
 
java.lang.Exception: Unable to load certificate key /usr/local/ssl/private/mycompany.com.key
 (error:0200100D:system library:fopen:Permission denied)
code:
[root@server bin]# ls -la /usr/local/ssl/private/mycompany.com.key
-rw-r----- 1 tomcat tomcat 1709 Sep 30 18:54 /usr/local/ssl/private/mycompany.com.key
What does it want from me? ps aux confirms tomcat was running as user tomcat, the owner of that file it can't read.

Chas McGill
Oct 29, 2010

loves Fat Philippe

TheresaJayne posted:

I started those at one time about 10 years ago, they started easy and then got mega hard even for a seasoned pro,
I hope you have lots of time as there was soooo much studying.

Although they keep saying that courses are being dumbed down.
The toughest thing about them is the amount of reading/memorisation required. M250 introduces almost every basic concept in Java (although it bizarrely omits switches and the ternary operator), M256 tries to be a primer on how to design software, but I had a tough time believing anyone develops in its style outside the NHS (probably). I found the TMAs fairly easy since I could refer to the materials.

Both exams were balls hard though.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
Looks like I am going to have fun then! I take it the exam is the vast majority of the grade too :/

Chas McGill
Oct 29, 2010

loves Fat Philippe

thegasman2000 posted:

Looks like I am going to have fun then! I take it the exam is the vast majority of the grade too :/
Your final grade will be split between your continuous assessment (TMAs, ICMAs) and the exam. You need +85% in both components to get a distinction, but you only need 40% to pass.

The most advanced thing you'll do in M250 is probably reading from and writing to CSV files, or iterating through collections.

M256 has very little programming since it's mostly theoretical.

The course materials for both modules is extremely wordy, so if you're struggling with any concept you can probably just google it and find a much more concise explanation on stack overflow/youtube/javadocs.

I will say that I feel like M250 gave me a decent grounding in Java basics and M256 got me interested in design patterns etc.

TheresaJayne
Jul 1, 2011

fletcher posted:

Trying to setup SSL on Tomcat (APR):

code:
 
java.lang.Exception: Unable to load certificate key /usr/local/ssl/private/mycompany.com.key
 (error:0200100D:system library:fopen:Permission denied)
code:
[root@server bin]# ls -la /usr/local/ssl/private/mycompany.com.key
-rw-r----- 1 tomcat tomcat 1709 Sep 30 18:54 /usr/local/ssl/private/mycompany.com.key
What does it want from me? ps aux confirms tomcat was running as user tomcat, the owner of that file it can't read.

Whats the folder permission (.) if its owner is root, group root and permission 770 then nothing can see into the folder,

of course for folders you have read write and execute, but they mean different things.
you may need to add execute to allow access to the folder.

Adbot
ADBOT LOVES YOU

HFX
Nov 29, 2004

fletcher posted:

Trying to setup SSL on Tomcat (APR):

code:
 
java.lang.Exception: Unable to load certificate key /usr/local/ssl/private/mycompany.com.key
 (error:0200100D:system library:fopen:Permission denied)
code:
[root@server bin]# ls -la /usr/local/ssl/private/mycompany.com.key
-rw-r----- 1 tomcat tomcat 1709 Sep 30 18:54 /usr/local/ssl/private/mycompany.com.key
What does it want from me? ps aux confirms tomcat was running as user tomcat, the owner of that file it can't read.

Try changing your permission to 644.

TheresaJayne posted:

Whats the folder permission (.) if its owner is root, group root and permission 770 then nothing can see into the folder,

of course for folders you have read write and execute, but they mean different things.
you may need to add execute to allow access to the folder.

I agree this may also be an issue, but I though you could read from a file with that permission owned by someone else but perhaps not root? Since I am at work, I don't have a linux box where I have root access with which to test.

HFX fucked around with this message at 14:10 on Oct 1, 2014

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply