Syed Mahdi

Ranch Hand
+ Follow
since Aug 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Syed Mahdi

Hello All,

I am in a situation here. I know that when you restart your websphere server in this case 7.0, the JRXML files are compiled into Jaspers. When i restart my server i see that the jrxml and loaded and it says Compiling... but i cant see any .jasper files for my jrxmls. Where is it compiling and where is it putting. I know i searched the whole websphere app server folder and there are no .jasper files. So what is happening here when the systemOut.log clearly says its compiling.

[1/22/13 10:20:16:241 AST] 00000031 jasperReportMu I org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView loadReport Compiling Jasper Report loaded from ServletContext resource [/reports/xml/JSreport1.jrxml]
[1/22/13 10:20:16:588 AST] 00000031 jasperReportMu I org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView loadReport Compiling Jasper Report loaded from ServletContext resource [/reports/xml/sreport2.jrxml]
[1/22/13 10:20:16:826 AST] 00000031 jasperTextView I org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView loadReport Compiling Jasper Report loaded from ServletContext resource [/reports/xml/sreport4.jrxml]


has any one got into this situation by any chance.

Thanks for the help.
Sar
9 years ago
Thanks Tim,

very nicely explained comments. I appreciate them.

I agree with you guys. I wonder why do I have an EAR project anyway cos in my ear project there are two jars outside as dependent projects for the war (Why are they outside beats me!) When i tried to mavenize the project, maven put these dependent projects as jars into the WEB-INF/lib folder unlike what RSA was doing using the .classpath eclipse file. so now everything is in the war and that lone war is in the ear. it doesn't make sense to me. if its a lonely war why not just deploy it as a web app rather than an enterprise app.

I know you have an enterprise app when you have a web app and EJB jars it make up an ear. but in my case now that i re structured my project through maven and the build comes in as a single war in an ear it doesn't make sense to me. Is there a benefit of making an ear file containing a war file.

I will appreciate if some one can explain me the difference in this case.

I am marking this thread as resolved as my original query of making the libs outside the war is answered.

Thanks
Syed...
10 years ago

Peter Johnson wrote:You don't want to do this.

First, servlets must reside in the WEB-INF/lib directory. (Well, let me say I've never heard of them being outside of it.)

Second, WARs are not transparent, any classes residing in JARs outside of the WAR will not have visibility to classes inside the WAR. This can lead to class not found exceptions.

If you have some utility classes that you are sure won't need to call back into classes in the WAR, you can do it this way: you will need 2 projects, one to build the WAR, the other to build the EAR.

The POM for the WAR should indicate the "provided" scope for all of the dependencies that go into the EAR/lib directory. This way the compile can use them to compile your servlets, yet won't package them into the WEB-INF/lib directory.

The POM for the EAP would list the the JARs that go into EAR/lib as dependencies.

(That is sort of off the top of my head, I haven't tried it before and rarely build EARs)



Hello !!

thanks for the reply. Servlets in lib? I thought they should be in WEB-INF/Classes/


Yes, I understand that Wars aren't transparent that's why i will go with the second option but a bit differently. (I am listing as this is one more way to do what you suggested as well for other users) I did this in my web app's Pom.xml





And in my Ear app's POM.xml added the dependencies of war (your on top of your head was actually right in this case too! nice one there )

So my lib in war/web-inf is empty and the libs are in the root of the ear. I only need to run it on a server to see if it works without any issues. hopefully it will.

I really appreciate your replies, they helped a lot.

Thanks.
Syed...



10 years ago

Hello all!


I am trying to build a war project. and on compile it gives me this error:

[compiler:compile] Compiling 432 source files to C:\Beta\ECORP5\ECORP5-web\target\classes ------------------------------------------------------------- COMPILATION ERROR : ------------------------------------------------------------- \Beta\fin\fin-web\src\main\java\com\comp\fin\utils\Formatter.java:[23,-1] cannot access javax.annotation.PostConstruct bad class file: C:\Beta\fin\fin-web\target\endorsed\javaee-endorsed-api-6.0.jar(javax/annotation/PostConstruct.class) class file has wrong version 50.0, should be 49.0 1 error



I am not able to get rid of this error. I am using java 6 and jdk 1.5 here is my POM.xml or part of it without unrelated stuff:


I am using NetBeans IDE to create an ear project and this is the POM of the war module. I am building it separately. I dont think that should be a problem.

I will appreciate if some one can tell me what is wrong here that it gives this error.

On a side note: When i created the Maven Ear project it was using JavaEE 6 so the war module was also using JEE6 but when i added some files in the webApp directory of the war module the JEE version changed in the war module properties to Java EE 1.4 I dont know how it is doing that and why or which file is making it change on module level.

Thanks Syed..

10 years ago
Awesome answer : ( we should have a point system like stack over flow) for the detailed and going a mile ahead to answer the query.

So appreciate it.

Ok, I will really appreciate it if you or some can take the same kind of interest just like the previous answer:

My app is packaged in an ear which only has a war. (No Ejbs),So maven puts all the libs in the WEB-INF/lib folder automatically. this is the default behavior.

My Manager asked me to package the ear file so that the libs are out side the war package kinda like this:

ear
--/lib/
---*.jar
--app.war
---WEB_INF/lib/(nothing there)

Or out of the app.war/WEB_INF/Lib folder into the root of the war



1) How can i change this behavior in maven to package it like this?
2) how can i manually package the ear file like that and see in deploy if it works or not.


See, when I did built the ear file with the default behavior, and deployed it, it asked for some libs that weren't needed at compile time and threw class not found exceptions in runtime (like groovy-all.jar for some spring aspect j jar (sorry don't remember where it was needed exactly)) and logback-classic.jar (which was used by a local project jar in the war)) so we place them in the lib of the ear. So my manager said to remove the libs from the app.war/WEB_INF/lib and place them in either these two places

1) either in app.war/lib folder OR ( will it matter if it comes out of the WEB_INF folder)
2) in app.ear/lib folder (will the app.war not have any problems with this)

I am not able to test it cos i don't know exactly how can i package it to my requirement.

If you have any way that i can test this structure please tell me as well.

thanks again. and really appreciate the way the answer was detailed out.

syed...




10 years ago
Thanks Deepak,

This does seem right, but what if we know that we are never going to move away from a vendor like IBM. then what are the cons of doing and building with RSA.

Thanks again in advance,
Syed..
10 years ago
Hi All!

I am trying to use Maven on a project. I had a web app which was supposed to be packaged as a war.
Now in the beginning it packaged the war with the libs in a "lib" folder in the root. But i changed something and now its packaging it in inside the Web-Inf/lib folder.

actually the issue is that the requirement is to package the war in the ear file and the ear file is suposed to have the libs in its root for the war to use.

Am i missing something here. when i make an ear project and add a dependency of the war project even then the libs are not created in the ear they remain in the war.

may be i am not understanding something here conceptually:

Where are the libs SUposed to be in a war for its use.

Where are the libs supposed to be in an ear for the war to be used.

I was told that by someone that they are supposed to be in the root of the ear and not inside the war.

help me out on this one. Is there a way to acheive this (to have the libs of the war in the root of the ear)?

thanks
syed...
10 years ago
Thanks for such a detailed reply, and sorry for replying so late.

I moved onto TestNG and actually found a good tool to do what I wanted: there is a tool called feeder4Junit and feeder4TetsNg and they are awesome tools for both testing frameworks. tho the junit one is a bit more mature than the testng version.

it takes a csv, excel file and gets the data from there the only problem is that the test method should have the same amount of parameters as the columns in the excel. I am testing through this and it is good.

thanks again for the reply and hope this helps someone as well.

Syed..
10 years ago
hi,

I have a conceptual or behavioral question:

Currently our whole company uses RSA and WebSphere for all projects. Before our new manager came, everybody was building ear files from within RSA ( from right click project> export > as Ear).

it was working and being deployed in production even and all was good. Now our new Manager came and said this is all wrong n we shudnt be relying on RSA. He is quite smart technically and his knowledge is excellent. He said he wants to do it through ant or maven and out of RSA, i have seen that due to RSAism in our company our apps are tied with RSA in some ways and they cant be actually be compiled properly outside but my question is this:

what is wrong with building ear files through RSA. It would let me actually work out through this more efficiently if i know what is that I am trying to solve here. cos the counter argument is : Its working why change ?

Thanks in advance.

Syed...
10 years ago
such nice and detailed explanations.

thank you sooo much.. both of you.

I really appreciate the answers.

confusion cleared.
10 years ago

Mark Spritzler wrote:One User could reference another User.

And while I see no benefit of having an object reference itself, I don't see exactly why that couldn't happen. Unless it has to pass itself into its own constructor.

Autowired is an Annotation, when you tell Spring you have it and to do something about it, then Spring will go out and look at all of its beans it has and find one that is of type User. If it finds one then it injects it. With just @Autowired and it finds more than one, then it throws an exception because it autowires by type by default and if there is any ambiguity, you have to tell spring how to fix it.

Mark



Thanks. well User is a session scoped component, which means there should be only one in session.

I thought this was a cyclic dependency: User has a property operations which has a property user which has a property operations which has a property user and so on..

Am I correct ?

will it not consume a lot of mem usage

thanks and appreciate the reply.

Syed..
10 years ago
Hi All!

I am trying to debug a verdor's app and it is giving me errors and exceptions at some points..

I would like to ask a conceptual question about auto wiring.

I have a class User that extends a class Profile that extends another class Operations that has an @AutoWired User user;

So its like this




Is it possible? a User has a property that has a property User. I know it is possible because it is a working code, but I think its recursively having the same object within itself. Should it not send me into a memory usage issue???

OR : When you Autowire a component you are actually referencing to it and it does not become part of the actual object ? I was under the impression that when you Autowire a component its actually a property of that class and Autowiring is only to populate it with respective values with whatever component its wired with. Am I wrong?

How can I prove my own assumptions or the other way?

thanks
Syed...
10 years ago
See this is what I said, for business analysts they cant use the paramterized pattern and code the testcases in Java. but they can make it in XML format. If I am using the paramterized pattern then I still need it to code and then parse the xml using dom or sax. You see I am looking at TestNG and it takes XMl as inputs. I was expecting the Junit must have by now added a feature where you specify the folder of the xml or even the xml and it runs the test case listed in it.

may be I didnt understand your answer, care to elaborate on the use of @Parameterized test case pattern

Thanks
mahdi
10 years ago
hello all,

I want to use JUnit, but instead of taking parametrized inputs from within a class, is it possible to have XMLs define the inputs so we give like 4 XMLs to a testcase and the same junit testcase is run four times iteratively with these four XMLs. Is there an add on for JUnit for that.

the only option after reading up a bit on JUNIT comes to me as making an XML parser and to marshall it to a testcase-parameter bean object which will represent a testcase scenario with defined parameters from the XMLs and I invoke the testcase with that four times.

is there a better or quicker way to do this.

Thanks in advance,

10 years ago
ok.. thats an idea, how do i bind the communication in a transaction or transactional sessions. a reversal is better than a half done communication.
10 years ago