• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Apache CXF and Properties file

 
Greenhorn
Posts: 3
Mac Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!,
First of all, thanks for your patience if you read this post.

I am converting a Java app into web services (Disclaimer: I'm not regularly a developer, only when I need to...) using Apache CXF2 runtime on Eclipse with Tomcat 7. As a bit of background, I will state the structure and what works:

////////////////////////////////////////////////Project structure:////////////////////////////////////////////////////////////
---xami
|_____src
|______com.xami.ws
|________AMIServices.java (<-- class file I am turning into Web Services)
|________ConnMgr.java (<-- JDBC connection manager)
|________ServiceTester.java (<-- sample client for me to test)
|______resources
|________config.properties (Properties file used by ConnMgr.java

////////////////////////////////////////////////ConnMgr.java:////////////////////////////////////////////////////////////



////////////////////////////////////////////////AMIServices.java (EXTRACTED METHOD...NOT WHOLE FILE:////////////////////////////////////////////////////////////




////////////////////////////////////////////////ServiceTester.java (SAMPLE TESTER FOR METHOD ABOVE getMeterStatus():////////////////////////////////////////////////////////////



////////////////////////////////////////////////CORRECT OUTPUT FROM DATABASE AFTER RUNNING ABOVE////////////////////////////////////////////////////////////

Connected to the database
M218907 | 1 | OFFLINE | 0 | 2012-02-22 12:47:04.0
M218900 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218904 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218908 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218905 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218909 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218901 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218910 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218902 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218906 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218903 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218911 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
M218899 | 1 | OFFLINE | 0 | 2012-02-22 09:28:55.0
DONE!

////////////////////////////////////////////////MY PROBLEM:////////////////////////////////////////////////////////////

When I create (in Eclipse) Web Services out of AMIServices.java, I get a WSDL created, I can see the methods, etc but ConnMgr.java is not able to pickup the properties file anymore. Here are the commands that CXF runs:

]java2ws -cp /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -s /home/alucarda/dev/workspace/xami/.cxftmp/src -d /home/alucarda/dev/workspace/xami/.cxftmp/wsdl -classdir /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -o amiservices.wsdl -soap12 -createxsdimports -verbose -frontend jaxws -databinding jaxb -wsdl -wrapperbean com.xami.ws.AMIServices
java2ws - Apache CXF 2.5.2

Feb 22, 2012 12:49:18 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://ws.xami.com/}AMIServicesService from class com.xami.ws.AMIServices
java2ws -cp /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -s /home/alucarda/dev/workspace/xami/.cxftmp/src -d /home/alucarda/dev/workspace/xami/.cxftmp/wsdl -classdir /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -o amiservices.wsdl -createxsdimports -verbose -frontend jaxws -databinding jaxb -wsdl -server -wrapperbean com.xami.ws.AMIServices
java2ws - Apache CXF 2.5.2

Feb 22, 2012 1:02:02 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://ws.xami.com/}AMIServicesService from class com.xami.ws.AMIServices
java2ws -cp /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -s /home/alucarda/dev/workspace/xami/.cxftmp/src -d /home/alucarda/dev/workspace/xami/.cxftmp/wsdl -classdir /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -o amiservices.wsdl -createxsdimports -verbose -frontend jaxws -databinding jaxb -wsdl -wrapperbean com.xami.ws.AMIServices
java2ws - Apache CXF 2.5.2

Feb 22, 2012 1:30:31 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://ws.xami.com/}AMIServicesService from class com.xami.ws.AMI
java2ws -cp /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -s /home/alucarda/dev/workspace/xami/.cxftmp/src -d /home/alucarda/dev/workspace/xami/.cxftmp/wsdl -classdir /home/alucarda/dev/workspace/xami/WebContent/WEB-INF/classes -o amiservices.wsdl -createxsdimports -verbose -frontend jaxws -databinding jaxb -wsdl -wrapperbean com.xami.ws.AMIServices
java2ws - Apache CXF 2.5.2

Feb 22, 2012 2:07:20 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://ws.xami.com/}AMIServicesService from class com.xami.ws.AMIServices



However, when I deploy it. and use SoapUI to request the same getMeterStatus(1), I get:

INFO: Inbound Message
----------------------------
ID: 1
Address: http://localhost:8080/xami/services/AMIServicesPort
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers: {accept-encoding=[gzip,deflate], Content-Length=[288], content-type=[text/xml;charset=UTF-8], host=[localhost:8080], SOAPAction=["urn:GetMeterStatus"], user-agent=[Jakarta Commons-HttpClient/3.1]}
Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.xami.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:getMeterStatus>
<!--Optional:-->
<arg0>1</arg0>
</ws:getMeterStatus>
</soapenv:Body>
</soapenv:Envelope>
--------------------------------------
Feb 22, 2012 2:11:17 PM com.xami.ws.ConnMgr <init>
SEVERE: resources/config.properties (No such file or directory)
java.io.FileNotFoundException: resources/config.properties (No such file or directory)

at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at com.xami.ws.ConnMgr.<init>(ConnMgr.java:22)

Has anyone seen this using CXF2 with Tomcat? I've been searching for a long long time and no answer. I have moved files around to no avail....Thanks for your patience again in reading this....
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic