A Thakur

Greenhorn
+ Follow
since Apr 06, 2010
Merit badge: grant badges
For More
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 A Thakur

You have to add JToolBar to JPanel. It should not give you any errors

For example:



See if it helps.

Thanks.
12 years ago
There are 2 ways of implementing ActionListener:

Option 1: To have common ActionListener Implemented


OPTION 2: To have individual actionlisteners


See which one is better for you. Both approaches have same end-results.

Thanks.
12 years ago
Hi all,

I found the problem. I had following code in getTreeCellRendererComponent() method

if(tree!=null){
tree.revalidate();
tree.repaint();
}


After commenting the above block, getTreeCellRendererComponent() is not called in a infinite loop. As a results CPU cycle always comes to 0 when no activity is performed.

Thanks again for all the help.
12 years ago
Hi,

I have a Swing application where I display information using JTree. I am using TreeCellRenderer as I have icons etc. on the JTree.

I noticed that when I launch my JTree, the CPU cycles goes to 25-26 and stays there. Even though I (user) do not perform any activity on the UI, the CPU cycles still remains the same till I close the application.

I added few println statement and noticed that TreeCellRenderer's getTreeCellRenderer() method is called infinitely till the Jtree is displayed. Probably it could be the reason for high CPU cycle.

Do you any suggestions, how can I resolve the issue. How can I use TreeCellRenderer and have control the CPU cycles ?

Thanks a million.

Regards.
12 years ago
Bill,

Thanks.

SOAP is not a requirement. I have flexibility to use any web/app server /SOAP. But only requirement is to pass 3rd party API object back to client. and unfortunately that 3rd object is not a serialized object .

Adding more to the mess, I cannot read all properties of 3rd party object on server and then send them to client as it adds significant amount of delay before client receives a response.

So I am exploring different options how I can achieve that.

If you have any suggestions, please let me know. I'll really appreciated.
Thanks.
14 years ago
Redy, Thanks. I got that.

My issue is I have to send the array of objects of custom class. Apart of literal poperties of that custom class, there is a 3rd party API instance as well.




I want to send the array of objects of DAO class. And when I try to do that I get following error:

Any suggestions. ??

Thanks.

java.lang.NullPointerException
org.apache.axiom.om.OMException: java.lang.NullPointerException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:260)
at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:335)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:737)
at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:706)
at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:124)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:297)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:213)
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(SOAPBodyImpl.java:231)
at org.apache.axis2.rpc.receivers.RPCUtil.processResponseAsDocLitWrapped(RPCUtil.java:381)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:138)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at org.apache.axis2.databinding.typemapping.SimpleTypeMapper.isSimpleType(SimpleTypeMapper.java:202)
at org.apache.axis2.databinding.utils.BeanUtil.getPropertyQnameList(BeanUtil.java:141)
at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:67)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.processProperties(ADBXMLStreamReaderImpl.java:998)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:835)
at org.apache.axis2.databinding.utils.reader.WrappingXMLStreamReader.next(WrappingXMLStreamReader.java:49)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:857)
at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:71)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:60)
at org.apache.axiom.om.impl.builder.SafeXMLStreamReader.next(SafeXMLStreamReader.java:183)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:597)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
... 28 more
[ERROR] java.lang.NullPointerException
org.apache.axis2.AxisFault: java.lang.NullPointerException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:161)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.axiom.om.OMException: java.lang.NullPointerException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:260)
at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:335)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:737)
at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:706)
at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:124)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:297)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:213)
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(SOAPBodyImpl.java:231)
at org.apache.axis2.rpc.receivers.RPCUtil.processResponseAsDocLitWrapped(RPCUtil.java:381)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:138)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.axis2.databinding.typemapping.SimpleTypeMapper.isSimpleType(SimpleTypeMapper.java:202)
at org.apache.axis2.databinding.utils.BeanUtil.getPropertyQnameList(BeanUtil.java:141)
at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:67)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.processProperties(ADBXMLStreamReaderImpl.java:998)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:835)
at org.apache.axis2.databinding.utils.reader.WrappingXMLStreamReader.next(WrappingXMLStreamReader.java:49)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:857)
at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:71)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:60)
at org.apache.axiom.om.impl.builder.SafeXMLStreamReader.next(SafeXMLStreamReader.java:183)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:597)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
... 28 more
14 years ago
Thanks Bill.

I tried to make Array from list.toArray() which return array of objects (Object[]).

Actually I have to return Array of custom objects.

But when I am returning Object[], I get the error.

My WSDL shows for
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:anyType" />

How can I get Array of custom objects.

Thanks.
14 years ago
I am using axis2 / webservice using Eclipse IDE. My webservice method returns a List (java.util).

When my client is calling the webservice method I am getting following error:

org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Any type element type has not been given



Then I checked the WSDL of webservice and I found that for the response I am seeking the following:

<xs:element name="getDocumentClassificationResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>


I am pretty sure it has something to do with this. Could you please help how I am get List or any other java Collection as return from my webservice method.

Also, the only way I can access the WSDL is through web browser by typing:
http://localhost:8080/TestWebService3/services/Testing?wsdl

I could not find any WSDL file in my project directory. If I have to edit the WSDL how can I do that.


Any help is appreciated.

Thanks a bunch.
14 years ago

My problem is little complicated, Here's my problem:

3rd party class: (unserialized- Not Open source)



Subclass:


Another Class: Gateway.java.

Service expose this method of Gateway.java. This will query database gets results in form of 3rd party API's instance



I want to capture all the properties of QueryResult class, plus additional properties for SubclassDAO set by Gateway.java and pass to the client.


I just want to transfer unserilazed object as SOAP response. One way is to get all properties of QueryResult and assign it to SubclassDAO (which can implement serialization) and send that instance back to client. But the processing of QueryResult object is very expensive and client can not wait that long.

So if I want to transfer the QueryResult instance to client then I can start background thread to get its properties and my GUI wont be freezed.



How can I do that.
14 years ago
Can I transfer the unserialized instance of a 3rd party API from service to the client as SOAP response.

Thanks.
14 years ago
One way is to read all properties of QueryResult in Gateway.java and assign it to SubClassDao instance and then send it client.

I should mention there is a strict need transfer the QueryResult object to the client. Reading all the properties in Gateway.java (server side) is very time consuming. Reason I want to transfer it to client, so then client receives response from server it can run background thread to get all properties of QueryResult and use it where necessary. So that server side resources can be saved.

Please help.

Thanks a million.
14 years ago
if you are planning to have Singleton class (like you said in your first post), then you will only have 1 instance of that class anyhow. Then your getId() and setId() will easily be available in the session (context). No need to make methods static. Even otherwise making such method static does not result in error.

Refer this post:
Just as a reference on similar topic:

https://coderanch.com/t/491292/Java-General/java/we-have-private-static-variables
14 years ago
Tim: Thanks for suggestion and url.

My problem is little complicated, Here's my problem:

3rd party class: (unserialized)





Subclass:



Another Class: Gateway.java




I want to capture all the properties of QueryResult class, plus additional properties for SubclassDAO set by Gateway.java and pass to the client.

I understand above readExtrenal() and writeExternal() method implementation is not correct here.

Few things I tried:

- Client is able to get projectName but not the queryResult object. out.writeObject(queryResult); in subclass implementation throws error compianing the queryResult is not serialized.
- I cannot do SubclassDAO dao = (SubClassDAO)result; in Gateway,java as this throws me type cast exception.

Please suggest. How can I make this work by proper implementation of readExternal or writeExternal


How can I do that.


14 years ago
Jesper,

I didnt mean to make it public. But just "private" could also serve your purpose of singleton class instead of "private static".

I guess I was not clear enough

Thanks for that.
14 years ago
I don't think the code you wrote above is wrong.

Only think I can think of is: you making the _instance private static for a singleton class is redundant. Since there will be only one instance of your class anyhow since you made your class's constructor as private.

And private static for _instance also ensures the same thing. Bottom line is there will not be more than one instance of your class.

Hope it helps.
14 years ago