Km Mahesh

Greenhorn
+ Follow
since Nov 24, 2005
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 Km Mahesh

I have two classes, say Product and ProductTO :
Other than fields, Product class also have several other different classes present as Collection (oneToMany), same goes with ProductTO.
When I use Dozer for mapping fields from entity Product to ProductTO, Dozer by default does copy all fields having same field names, but I don't want to copy all fields. Rather I will define a mehtod findFinishedProduct(), which will copy selected fields from Product to ProductTO while another method findScrapMaterial() will copy different set of fields from Product to ProductTO.
Is there any way to define a set of fields, say in xml configuration file, which I can refer in different methods while copying. How can I accomplish this with Dozer efficiently ?
Thanks.
Here is the client code calling the createReport() method...



Is anything going wrong here?

Dan Kempten wrote:
You should put the @EJB above an instance variable that represents the Bean you wish to inject.
And keep it inside the class.



As I already explained above, that I don't want to inject the ejb. (For there is no way to inject the ejb conditionally.)
That's why I am using the JNDI lookup.

Dan Kempten wrote:
I use it in a web app or a client app to replace this code :



Does your above code works? Where did you define the JNDI name "MyJNDINameOfMyBean"?
Or did you replace the above code b'coz it was not working?

Dan Kempten wrote:
with this code :



By this you are actually injecting the bean, which I don't want to.
If this optional element "mappedName" is not defined, still the ejb does gets injected.
Is there any specific reason for defining this element?

Finally I want to get the ejb reference through JNDI lookup and not by DI.
Hello All!

Can anybody please explain me why the JNDI lookup method is not able to find the the local interface reference which is defined through annotation in another ebj?
Any help would be appreciated.

Thnx & Rgds,
Mahesh
1) Local Interface


2) Remote Interface


3) EJB


4) Registring a reference to CircuitServiceSLSB EJB under the logical name CircuitServicesRef
In the ReportingServiceSlsb EJB, I am trying to lookup the local ejb interface CircuitServiceLocal.



Here in the createReport() method the lookup fails throwing the NameNotFoundException. (try catch is there in the code but not shown.)
In createReport() method I want the reference of the CircuitService EJB (local).

Exception:
javax.naming.NameNotFoundException: java:comp/env/CircuitServicesRef not found in ReportingServiceSlsb

Can anybody explain what is going wrong here.
I am using OC4J 10.1.3.4.0 and JDK 1.5.0_16

I know here I can inject the ejb using @EJB annotation, (and that works fine in my code) but for different reason, I have to use the JNDI lookup method.

One more thing is that I am using the lookup method to lookup the remote interface by passing the ejb name CircuitServiceSLSB, it is working fine.

the remote Lookup


Thanks & Regards,
Mahesh
Hi,

I am new to Hibernate.
I am using Hibernate 3.2.0 with Spring framework and Oracle9i database.

I need to save files (pdf/xls/doc) using hibernate as blob datatype in oracle.

I tried google but was confused to get the exact solution with the technologies I am using, so thought to put a question here.

Does anybody have the sample code or reference links, which explains in detail to save blob datatype using above mentioned technologies?

Let me know if any more inputs are needed.

Thanks in advance.
Thanks Joe, the problem gets solved after removing the reference to the declared DTD.
12 years ago
Okay....the problem is not with URL passed to a build() method. Actually the
build() method of SAXBuilder class can take a File object, a URL of a File object and as well as a String object containing the File path.

The problem was with the XML file (web.xml) i was trying to load, here is the code snippet:




After I tried to load a new simple XML file, it works fine...code snippet :



Since i am newbie to XML, wondering what's wrong with the web.xml file? Is there any other way to load a XML file in jDOM?
12 years ago
I am getting above exception when i tried to access a local file through my application. Here is the code:

String filename = "C:\\users\\mahesh\\jDOM\\test.xml"; //args[0];
try {
// Build the document with SAX and Xerces, no validation
SAXBuilder builder = new SAXBuilder();
// Create the document
Document doc = builder.build(new File(filename).toURL());
// Output the document, use standard formatter
XMLOutputter fmt = new XMLOutputter();
fmt.output(doc, System.out);

DocType docType = doc.getDocType();
System.out.println("Element: " + docType.getElementName());
System.out.println("Public ID: " + docType.getPublicID());
System.out.println("System ID: " + docType.getSystemID());

} catch (Exception e) {
e.printStackTrace();
}


And here is the stack of error:


java.net.NoRouteToHostException: No route to host: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:810)
at xmleditor.XmlEdit.main(XmlEdit.java:27)



Any help appreciated.
12 years ago