Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Hector Pertierra

Greenhorn
+ Follow
since Jun 06, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hector Pertierra

Solved. I used antony_miguel's super-duper ClassPathHacker as a base to be able to run loadClass method. I don't really know if it was necessary, but now it works

Just add another method called loadClass and do the same that with addURL

Tnx!
13 years ago
Hi everyone.

I am doing a little application for executing classes dynamically. I'm already able to test it by loading one class at the time to the classpath at runtime, but now I have to do it by loading all those classes from a JAR.

I have my .class files on a .jar, which is successfully loaded to the classpath at runtime, so I know the classes are there somewhere. Now what I have to do is execute given methods (user enters method names on the UI) on those classes but I don't know where to find them and if it's possible to invoke reflection on them.

Any thoughts??

Thanks in advance.
HP
13 years ago
Hi. I have a problem with my AOP subject's final project.

I need to do a little application that show's a code snippet with an error (for instance, something posted as a question on this forum), runs that class, shows what fails and then runs the same snippet but with the error corrected. After much bargaining, we got the teacher to let us actually load the .class files necessary to run the problem and the solution, which I've managed to do using the Java Reflection API. The problem is that many of these problems are Spring AOP's, and they need their applicationContext.xml file to run.

My question is: how can I tell the classes which I'm loading and running at runtime to use that XML file???

I hope I made myself clear. If not, please let me know.

Thanks in advance.
HP
I don't think it's "what they think" I think that that difference exists. And I can't ask because I have another test tomorrow and he won't answer any questions that's why I tried asking you guys

Anyway, if I don't get an answer, I'll ask my teacher after the exam and then I'll tell you.

Thanks
HP
13 years ago
Uhmmmm... No, I think they're not. I say this because I am using AspectJ for Aspect Oriented Programming, and it defines two completely different Join Points for method invocation and method calls.

I was asked to tell one from another in a test today, and got it wrong, so I thought I'd ask. But maybe I posted it in a too basic forum. Please move it if pertinent.

Thanks
HP
13 years ago
Hello everyone

One of those things I never learned quite correctly: What's the difference between method invocation and a call to a method. When do each one of them starts and when do they end?

Thanks
H�ctor
13 years ago
Ok, I think I can get it right now.

Thank you all!
13 years ago
Hello again, thanks for you responses.

RoshaniG, I'm confused, because I thought Actions executed only when I submited my form... So where should I put that?

Ulf, how do I put JSP's in a non-accesible directory? And also, how do I make them only accessible through the Action??

Merrill, so that Action would make all the forwards?? Where in that code do I specify which Action to go through first.

Thanks a lot!!! I hope I'm not asking questions too obvious
13 years ago
Hi

I'm using Struts to make a little web app, but I'm having trouble while testing. Even though I have added session protection to my Actions, I haven't been able to stop the browser from skipping authentication and going to any JSP that I want just by typing in the URI.

What can I do to stop that from happening? I also have access levels, so the user doesn't have just to be authenticated, but have permission to access that page as well.

Thanks in advance for your help.

HP
13 years ago
I personally recommend CVSNT, it is quite stable, much more easy to set in your own computer and it has a nice, easy to use GUI.

It worked for me and I have never ever used version control.
After fighting with the CLASSPATH for more than 24 hours, I fixed it

I had to put the JAR File next to the distribution. And set the Manifest's Class-Path to the JAR File. It finally worked. Thanks!
13 years ago
Yeah, I'm aware of that, but how do I PUT them into the classpath???
13 years ago
Hi everybody

I have a BIG problem with my ANT buildfile. I'm trying to run a simple Test to connect to my app's database, but after it succesfully COMPILES and JARS itself, when it gets to EXECUTE I get the following message:

[java] org.dotcom.contab.proceso.DAOException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[java] at org.dotcom.contab.proceso.impl.MySQLDAOFactory.<init>(Unknown Source)
[java] at org.dotcom.contab.proceso.DAOFactory.getDAOFactory(Unknown Source)
[java] at org.dotcom.contab.salida.Main.main(Unknown Source)
[java] Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[java] at java.lang.Class.forName0(Native Method)
[java] at java.lang.Class.forName(Class.java:164)
[java] at org.dotcom.contab.proceso.impl.MySQLDAOFactory.loadDriver(Unknown Source)


I know I probably have a problem with the CLASSPATH, since I'm running the app directly from the jar archive: here's the code:






I'm really really stuck, I've tried a bunch of things and I don't know what to do anymore. I read somewhere that when running a program from the jar it ignores user classpath settings, is it true??? I NEED to run it from the jar since it's one of the projects requirements...

PLEASE HELP!!!

Thanks in advance
Hector
13 years ago
I think that finally made it clear. I asked one of my teachers (yes, back to school) and he said that, of course, the Delegate should never EVER contain business logic; instead, it should contain the calls to wherever the business logic is, maybe using a Facade or a Service Locator (if needed).

So thank you very much to everyone again, and see you around very soon.

Hector
Hello again everybody

Just for reference in case someone ever gets the same confusion than I did, lemme show you the document that caused it all.

http://rollerjm.free.fr/pro/Struts11.html#3

You see, right at the bottom of the BussinessDelagate line, it states that it
"Encapsulates the Bussiness Logic and access Model". So, that's exactly what
I did (or thought of doing, at least).

If anyone wants to clarify that sentence, please go ahead!

Thanks again for all your help!

Hector