Eric Lopez-Fernandez

Greenhorn
+ Follow
since Oct 13, 2011
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric Lopez-Fernandez

Hi Prajakta Acharya,

I never got that certification, the reason? Spring!

I started working with Spring some years ago and I do not think it is worth it to waste your time with EJBs. I do not have the exact figure but it is something like 70% of the Java EE applications that are being developed are developed with Spring, it is flexible, scalable, robust, it integrates well with REST technologies, it has everything you need.

Make long story short, don't bother with any certification from Oracle.. other than the Programmer one.

Regards,
Luis
Hey there,

I am interesting in exploring the Software Architecture field and I am looking for a course or certificate that might help me accomplish that.

Do you know of any certificate that I can take online?

Any help will be greatly appreciated!

Kind regards,
luisericlf
Hi Peter,

Could you please advice on how to do that. I am currently using maven-assembly-plugin. I run it twice, however, the jar with al the dependencies is a big file and by the time when it is finally created the zip file was created already and does not contain the jar. Do you know of any way to stop maven assembly from starting to create the zip until the jar is finished. Here is the portion of my POM that is related to that:



And this is my dep.xml file



Thank you very much for your help!
Eric
6 years ago
Thank you very much for your reply Peter!

Here is the scenario I'm dealing with.

I have to generate zip file that contains

One jar file with the application
One jar file with all the dependencies
Some help documents that will be placed under the HelpDocs directory
Some bat/sh files that will be placed under the OtherDocs directory

My idea is to generate the zip with the assembly, as well as the dependencies jar. The app's jar is created in the POM in the following way..

<packaging>jar</packaging>

Do you know of a more efficient way to accomplish that?

Thanks again!
Eric

6 years ago
Hi Karl,

Thank you very much for your reply. In my case I really need to use an assembly descriptor because I am adding other files to the final distrubution. From my limited knowledge I see that you can use either

<descriptorRefs>
<descriptorRef>myassembly.xml</descriptorRef>
</descriptorRefs>

or

<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

Is that correct? If that is the case, then I really need to find a way to generate the jar from the assembly descriptor. So far, I am getting all the dependencies sent to the final distribution, however, they are not in a jar file as I need them.

Does it make sense?

Thank you in advance,
Eric
6 years ago
Hey there,

I need to create a jar file with all the dependencies defined at the pom. I understand I have to use the maven assembly plugin.

Here is what I am doing...



Dependencies are generated in the distribution zip, however, I need them to be inside of a jar file, let's say something called dependencies.jar

What am I missing?


Thanks in advance for your help!
Eric
6 years ago
Hello,

I am just getting familiar with maven and the project that I'm working on requires me to leave a jar inside of the lib folder. I have accomplished that maven "reads" it when compiling, however, I understand I'm not doing it in the best way. Here is the portion of my POM that does that:

<dependency>
<groupId>org.XLogger</groupId>
<artifactId>XLogger</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/java/lib/XLogger.jar</systemPath>
</dependency>

When I run mvn compile I get the following message:

'dependencies.dependency.systemPath' for org.XLogger:XLogger:jar should not point at files within the project directory, ${project.basedir}/java/lib/XLogger.jar will be unresolvable by dependent projects @ line 84, column 16

Does anybody know a better way to make maven read some jars inside of the lib folder without using systemPath?

Any help will be greatly appreciated!
6 years ago
Thank you very much for the explanation, I appreciate that!
6 years ago

The problem was fixed by removing the <dependencyManagement> tag. Somehow it was not allowing to download everything.

Thank YOU all for your help!
6 years ago
Thank you for your reply E Armitage!

That is the first error message. If I go to ~\.m2\repository I am not able to find anything related to org.eclipse.persistence, however I am able to find stuff related to maven-compiler-plugin

I was wondering if the problem is with the repository that I'm specifying or with the version number for the dependencies. Do you have any idea?
6 years ago
Hey there,

I am having trouble with maven. I do have the following POM.xml file



And here is the error message I'm getting

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project chapter02: Compilation failure: Compilation failure:
[ERROR] ~\05292012\src\main\java\Book.java:[3,0] package javax.persistence does not exist

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

It seems like maven was not able to download the dependency for org.eclipse.persistence

Has somebody had that problem before?

Any help will be greatly appreciated!
Eric
6 years ago
Hey there,

I am getting the exception from the title of this post whenever I try to run the following code:

File imageFile = new File (path);
BufferedImage img = ImageIO.read(imageFile);

I know that it a permissions-related problem not that the image has the read-only flag checked, but, that my user (at an OS level) does not have permission to open the image - I'm not even capable of opening it directly with the OS.

My question to YOU guys is, is there any way to check the permissions before trying to open a File. I do not want to use
File.canRead(), File.canWrite(), or File.canExecute() because they check whether the file has the read-only flag checked, but that does not work for me.
What I need to check is if the user has permissions over the object he's trying to open.

This is the read method from the ImageIO class.

public static BufferedImage read(File input) throws IOException {
1275 if (input == null) {
1276 throw new IllegalArgumentException ("input == null!");
1277 }
1278 if (!input.canRead()) {
1279 throw new IIOException ("Can't read input file!");
1280 }
1281
1282 ImageInputStream stream = createImageInputStream(input);
1283 if (stream == null) {
1284 throw new IIOException ("Can't create an ImageInputStream!");
1285 }
1286 return read(stream);
1287 }

Unfortunately it uses File.canRead() to check permissions and that's not what I need.

Any help is greatly appreciated!
6 years ago
Hey there,

I am trying to implement an annotation that will function similar to the javax.validation.constraints.NotNull but something that I can use with Java SE.


I have the following annotation but it does not seem to work. Can you please take a look?

Here is the annotation:

-------------------------------------------------------------------------------------------------------------------

import java.lang.annotation.*;

/**
* Designates that a field, return value, argument, or variable is
* guaranteed to be non-null.
*/
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
@Documented
@Retention(RetentionPolicy.CLASS)
public @interface NotNull {}

-------------------------------------------------------------------------------------------------------------------

Here is the class that will use it:
-------------------------------------------------------------------------------------------------------------------
public class UsingNotNull{

public void notNullMethod(@NotNull String cadena){
System.out.println(cadena.trim());
}
public static void main(String... args){
String cadena = "it works!";
String cadenaNula = null;

UsingNotNull unn = new UsingNotNull();
unn.notNullMethod(cadenaNula);
}
}
-------------------------------------------------------------------------------------------------------------------

Thanks in advance for your help!



6 years ago