Kacee Saxena

Ranch Hand
+ Follow
since Mar 04, 2008
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Kacee Saxena

Thanks for the reply Harsha.
I also thought somewhat on the similar lines. Theoretically, Interfaces define a default behavior . In my class, Currency term itself is bit abstract. I can not think much about what behavior this class can hold. Still, roughly, there may be a need of certain methods like
getCurrency()
currencyConvert(from,to)
currencyExchangeRate(year,from,to)

and if I use a class here, which later results in a superClass, then for a subclass usage of these methods may be a small job, and it may have to do bigger task by extending one of other more relevant and useful class. Extending Currency superclass may result into a waste.
Hence, interface can be used.

Is this understaning correct for having an interface for Currency ? Any better explainations are most welcome.

After some thinking , now I am using this class in following manner:


6 years ago
If I have to directy access like - <interface>.<variable>
i.e.
Currency.currency currencyVal
setVal(Currency.currency.RUPEE);

then why to implement interface ? This can be anyways done just by importing interface. As the field (enum) is already public static and is accessible outside to any class importing this interface.
6 years ago
Hello techies,

I have a code where I have declared one interface, that only contains one enum and a setter for it. Since enum can be directly accessed, and interface fields are public , static by default, (final doesnt matter to me , with enums) . Here is a code that doesnt need that interface to implement ever. Although i dont think it is a good practice to declare an interface, and never implement it , and directly access its state variables. Please have a look.


One user class , that needs to access the information from interface


Output :
displaying: RUPEE

Here I have few questions:
1) First , why need an interface just for a single state variable. This interface holds nothing more than one variable and its setter. ( I have been told that its a good design practice if Currency information is coded this way)
2) In case point 1 is accepated, then question is if Test.java class implementation is working fine, then when the need would arise to implement the interface ?
3) Other way , just for the sake of implementing, I can have Test class implement the interface and have knit looking getters/setters like



// I consider above as a bad practice.

3) Somehow I am not convinced with the code shown with class Test.java ( previous one, not implementing interface). What is the best way to access Enum from an interface.

4) In my app, Test class is exposed to other layers. The value in Test class is getting set from outside class. In my opinion, better way would be

- From outside class,
public void outsideClassSomeMethod{
Test.CurrencyType = RUPEE; // instead of setting via setter
}

- In Test Class,
public class Test implements Currency and
Sysout("Display : " + Test.CurrencyType.toString()); // should access static fields in static way

Please pour in your comments, which is the best way to do this.
6 years ago
Hello everyone,

I solved my problem.

I had a common maven repository and an interface to operate on that repository. That interface could also generate POM.xml for the third-party library I wanted to add, and my job was done.

So after all this, I have concluded

Any third-party library needs to have pom.xml file.
Not sure about its content.

Anyone, please add to this post, if there are any other ways to do this.

Thanks,
Kacee
7 years ago
Putting forward slashes did not work.

The above error :

org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: ins
tall. It requires a project with an existing pom.xml, but the build is not using
one.

got resolved by running the mvn install command from the existing Maven project, as it took its pom.xml.

But however, m back to same point :
org.apache.maven.lifecycle.LifecycleExecutionException: The packaging for this p
roject did not assign a file to the build artifact

Please help.
7 years ago
Thanks Peter. But now I'm gettign this error:

D:\>mvn -e install:install -Dfile="D:/test/com.project.MyApp.externalLib-1.0.jar" -DgroupId=com.project -DartifactId=MyApp -Dversion=1.0 -Dpackaging=jar

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [install:install]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: install. It requires a project with an existing pom.
xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: ins
tall. It requires a project with an existing pom.xml, but the build is not using
one.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6
0)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo:
install. It requires a project with an existing pom.xml, but the build is not us
ing one.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:414)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:694)
... 17 more

Do i need to create pom.xml in my "MyApp" project ? Is that really so ?? If yes, how can i create pom.xml with minimal addition ?
7 years ago
I want to include external jar to my existing maven project. I used following command to install it to local maven repository:


mvn -e install:install -Dfile="D:\test\com.project.MyApp.externalLib-1.0.jar" -DgroupId=com.project -DartifactId=MyApp -Dversion=1.0 -Dpackaging=jar

and got following exception:

org.apache.maven.lifecycle.LifecycleExecutionException: The packaging for this p
roject did not assign a file to the build artifact

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6
0)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: The packaging for thi
s project did not assign a file to the build artifact
at org.apache.maven.plugin.install.InstallMojo.execute(InstallMojo.java:
124)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:694)
... 17 more

What needs to be done in this case ? I am not getting any useful articles on internet as well.

Basic question : It "should" be possible to add a third party non maven library to a maven project. Is this correct ?

Also, what can I check to have this working ?

Thanks,
Kacee

7 years ago
Hi Jeff,


I have one application where code is separated into two modules - UI comprising of Android and business logic - Pure Java Code.

I want to get the memory footprint of my java code when run on emulator. In this, I dont want to include my android classes, just the non-android code. My application loads large files, want to test application performance when run on emulator.

So, I created Test Project using Android Instrumentation framework and have test cases written there. This testAndroid project(AndroidProj1) starts main activity of "Original Android project" (AndroidProj2). AndroidProj2 has a Java Project (JavaProj) dependent on it.

Now, the problem is , when I run my Android Project(containing UI classes, and dependent Java proj) via AndroidProj1, I get an error - "Process crased" , with no relevant description in logcat.

and when I run same after removing dependent java project, android test cases (AndroidProj1) runs fine, with proper results of test cases(soem dummy test cases).

Can you please suggest as what I can check and correct ?

My aim is to get memory footprint of Java project when run on Emulator.

Thanks in advance,
Kacee
7 years ago
I understood that qName is optional as per Java docs found here :

http://java.sun.com/j2se/1.5.0/docs/api/ ( ContentHandler)


what i am not getting is I have another piece of xml input :


which gets parsed successfully with all default properties. Tokens are going to qName.
But when i am trying same with code mentioned in initial post, my qName is remaining empty.

7 years ago
Can you please provide a link that has details of how SAXParser actually parses input to "localName" and "Qualified Name" string.

Getting many docs, but couldn find much relevant and detail.

Something is wrong with my code / input format(spacing) / Namespaces. Need to figure it out ASAP.

Thanks,
Kacee
7 years ago
startElement( , ,,) method is not gettign called properly by SAXParser. The qName value is getting assigned to localName variable. Please see screenshot attached. (Not able to paste the image )
Is it some nameSpace problem ?

HTTP Response xml looks like :

<status>
<created_at>Thu Mar 23 00:03:19 +0000 2006</created_at>
<id>123</id>
<text>finished analyzing smam/ac success rates</text>
<source>web</source>
<truncated>false</truncated>
..
.
</status>

Please help
7 years ago
Yes, I could see my application deployed on Tomcat Manager webpage , only when i am manually placing .war file to /webapps.

But I can not see application deployed, if I try to do deploy from Eclipse. Neither console is giving any error message.

Secondly,

Say if i go for manual option, while deploying through Tomcat Manager, correct URL is not gettign formed.
i.e. I have URL defined llike this in my wsdl file

<wsdlsoap:address location="http://localhost:8080/testService2/services/HelloService"/>

whereas, when i deploy it, the URL shows : http://localhost:8080/testService2/
I think somewhere other than wsdl file, i need to specify "the left over URL paramaters"
Can anyone please please help me.


7 years ago
Hello Friends,

I am not able to re-deploy my web service in eclipse 3.5. When i launch it for the first time (Run on server option ) it works fine. But successive deployments are not working.
It errors out saying -

description The requested resource (/testService2/) is not available.
HTTP Status 404 - /testService2/

Thsi is my deploy.wsdd file (wsdl)
==================
<code>

<?xml version="1.0" encoding="UTF-8"?><!-- Use this file to deploy some handlers/chains and services --><!-- Two ways to do this: --><!-- java org.apache.axis.client.AdminClient deploy.wsdd --><!-- after the axis server is running --><!-- or --><!-- java org.apache.axis.utils.Admin client|server deploy.wsdd --><!-- from the same directory that the Axis engine runs --><deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<!-- Services from HelloServiceService WSDL service -->

<service name="HelloService" provider="java:RPC" style="wrapped" use="literal">
<parameter name="wsdlTargetNamespace" value="http://test.com"/>
<parameter name="wsdlServiceElement" value="HelloServiceService"/>
<parameter name="schemaQualified" value="http://test.com"/>
<parameter name="wsdlServicePort" value="HelloService"/>
<parameter name="className" value="com.test.HelloService"/>
<parameter name="wsdlPortType" value="HelloService"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlnsperNS="http://test.com" xmlns:retNS="http://test.com" xmlns:rtns="http://www.w3.org/2001/XMLSchema" name="getName" qname="operNS:getName" returnQName="retNS:getNameReturn" returnType="rtns:string" soapAction="">
<parameter xmlns:pns="http://test.com" xmlns:tns="http://www.w3.org/2001/XMLSchema" qname="pns:name" type="tns:string"/>
</operation>
<parameter name="allowedMethods" value="getName"/>

</service>
</deployment>

</code>

What am i missing ?

I created another test webservice, facing same problem with it as well.

Please help

7 years ago
yes, it should be possible with Axis2. Please try and let us know in case there is a problem.
7 years ago
Somehow , issue is resolved.
Although i did not do anything new.

Now, on start status, i can see lcoalhost homepage.

Now, the problem is i am not able to deploy application when i select option - 'Run As " -> Run on server in eclipse for one of the working web applciation.

I checked physical location of tomcat_home/webapps directory and could not see my deployed application. Can someone suggest how to verify if the application is deployed through while runnign from eclipse?

Thanks,
Kacee
7 years ago