Joao Longo

Greenhorn
+ Follow
since Jan 04, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Joao Longo

I found the problem in Tomcat's documentation:

Note: Once one web application using sessionCookiePath="/" obtains a session, all subsequent sessions for any other web application in the same host also configured with sessionCookiePath="/" will always use the same session ID. This holds even if the session is invalidated and a new one created. This makes session fixation protection more difficult and requires custom, Tomcat specific code to change the session ID shared by the multiple applications.

The issue is related to cookie path, and not with domain
10 years ago
I don't agree completely with the sentence: "It's better to devote time to more productive concerns". I had a requirement to change JSESSIONID's domain to ".something.com" for a reason X. But this has caused the issue I reported on this bug.

This may difficult troubleshooting on my system. So, my question is if there is some configuration on Tomcat to do not keep JSESSIONID value the same when invalidation session. I don't want to change JSESSIONID in app. I want Tomcat/Spring takes care of it as before I've changed its domain.
10 years ago
Hello

I got your point. In fact, I need one of the two behavior below:

1. When I call session.invalidate(), JSESSIONID cookie is removed
or
2. When I call session.invalidate(), JSESSIONID cookie value is changed

The option #2 was happening before I change JSESSIONID's domain to ".something.com".

Now, although HTTP session gets clean, JSESSIONID remains with the same value. This means that the next time (without close the browser) user enters on my app, JSESSION will have the same value! This is disturbing troubleshooting.

I've already tried the following workarounds without success:

1. Call request.getSession(true) after I call session.invalidate() -> session is created with JSESSIONID value equals to previous one
2. Remove the JSESSIONID cookie explicitly -> it doesn't work
10 years ago
I think the situation is not clear. The JSESSIONID domain was changed and Tomcat was restarted.

When a user enters on the app, he receives a JSESSIONID, e.g., "12345678". The problem is that when this user leaves the app (calling session.invalidate()), the JSESSIONID value does not change, it remains "12345678", but the session values was reset.
10 years ago
Hello people!

I needed to change JSESSIONID's domain to ".something.com" in a context.xml file:



After that, when I perform a httpSession.invalidate() the session is reset but JSESSIONID value does not change.

I'm using Java 7, Spring MVC and Tomcat 7. I also tried to remove the JSESSIONID cookie manually, but it seems that Tomcat or Spring are not letting I change its value.

This may difficult troubleshooting on my system. I'd like to know if it's possible to change this behavior either on Spring or in Tomcat.
10 years ago
Hello people!

I'm able to send RTP sound through JMF, but now I need to change the RTP packet size to 160 (it seems that the default is 480 as I saw in com.sun.media.codec.audio.ulaw.Packetizer JMF class). The problem is that I haven't found yet where can I set the packet size. In fact, many JMF classes are instantiated by Reflection.

Here is a snip of my code:

11 years ago

Oscar Gm wrote:I have the same problem... Did you find a solution?


Yes, I remove Cobertura plugin
13 years ago
Hello people!

I've used embedded glassfish in the following way:


The problem is that embedded glassfish uses the classes in "target/classes" and maven cobertura uses "target/generated-classes/cobertura". Then, the first time the tests run it's ok, but in the second time, when cobertura run, I receive a java.lang.RuntimeException: javax.naming.NamingException (probably because cobertura is working on "target/generated-classes/cobertura" while glassfish is working on "target/classes").

Any ideas to solve this problem???
13 years ago
Thanks a lot!

But the fact is that I'm using a lib that needs the file path of this file. Is it possible to get?

Hello people!

Inside my .ear

-META-INF
-lib
-ejb-shared.jar
-ejb.jar
-com/ejb/... (classes)
-fileXml.xml (file I'm trying to access)
-web.war


Some description:

* "ejbshared" contains some ejbs and JPA entities
* "ejb" contains some ejbs and JPA entities and uses "ejb-shared" project


The problem is that I can't access fileXml.xml. Inside an EJB bean (of ejb.jar) I've done:

File f = new File("fileXml.xml");
System.out.println(f.exists()); // returns false!

I don't know why, but it seems that fileXml.xml is not in the classpath, althougth it's present in the .ear, or maybe I'm doing things in the wrong way!

Hi people!

I have a system using EJB + ZK framework (for presentation layer). The layers of the system are:

* presentation
* application - connects presentation with services
* services - EJBs
* domain - JPA entities

I would like to separate the data between services and application in order to do not have attached entities in application layer. I've read about Data Transfer Object design pattern and some strategies. But I also realize and read that if my entities are always detached in application/presentation layers I'll solve my problem. How can I ensure that? What do you think about this approach?

Thanks a lot!

Vijitha Kumara wrote:

In fact, I'm making a lookup, but it's not working properly


What do you mean, lookup failed or something else? If the former then I think you should fix that first.



Sorry, lookup is not failing, but I got an error as explained in the topic
Hi!

Vijitha Kumara wrote:

TestEntity - entity with a @PrePersist method. This entity is staying in the transaction after it is committed by the container


Can you elaborate this little more?


Yes. Relying on the fact that everything works fine if I clear the entity manager before the insertion of the Auditing entity, I believe that the TestEntity is getting stuck in the transaction.

Looking at this article http://simboss.blogspot.com/2008/10/entity-lifecycle-listeners.html , the autor wrote:
"Listener classed do not support dependency injection, they are not managed classes. Note that you can still use JNDI and fallback onto pre-EJB3 mechanism to get resources such as EJB interfaces, Transactions and the like."
In fact, I'm making a lookup, but it's not working properly



Looking at the error it seems your second insert for auditing also tries to insert the previous entity. Do you have a separate table for Auditing? Just add the table name for the @Entity annotation as well.


Yes, Auditing is in a separate table. I tried what you suggest but I got the same error
Hi people!
I have a weird error of double insert in the DB. I'll summarize the problem and then put the codes.

I have the following classes:
- TestEntity - entity with a @PrePersist method. This entity is staying in the transaction after it is committed by the container
- Auditing - audit entity
- Dataset<T> - interface of DatasetBean<T>
- DatasetBean<T> - Stateless bean which implements Dataset
- DatasetFactory - instance an EJB of Dataset (lookup)
- PersistenceLifeCycleListener - an entity lifecycle listener, defined in orm.xml file (following the example in http://docs.jboss.org/hibernate/core/4.0/hem/en-US/html/listeners.html)

I put the problem in a junit test (I'm using embedded Glassfish):


The flow of the test is the following:

1. After gettint a Dataset object, I try to insert a TestEntity object



2. After insertion, the PostPersist listener is called, and I try to insert an auditing entity. Here, if I uncomment //dataset.getEntityManager().clear(), the test passes. Otherwise I got an error (log below).




Log - look out lines 6 and 10, hibernate inserted the same entity twice:


persistence.xml


orm.xml


TestEntity


Auditing


MyEntity


What am I doing wrong?