Tag Archive for java

Apache CXF Without spring

I found a very good blog post about that topic, here: http://chathurangat.blogspot.com/2014/02/apache-cxf-first-jax-ws-soap-web.html

I copied there, to be here also for the future:


Apache CXF First JAX-WS (SOAP Web Service) Example (CXFNonSpringServlet)

The most of the people think that the Apache CXF supports only to develop Spring based Web Services. this is NOT true. is supports to build both Spring based and Non spring based web services.
1. CXFServlet –  this will support for the Spring based web services.
2. CXFNonSpringServlet –  this will support for the non spring web services.the purpose of this article is to demonstrate how to develop non spring based web service with Apache CXF. i have already developed and  tetsed the service with SoapUI. i am just sharing the source code for your reference.the project structure looks as below.,

pom.xml


 

CalculatorService.java

the following is the Service Endpoint Interface(SEI).


 

CalculatorServiceImpl.java

the following is the Service Implementation Bean (SIB)


 

AppCXFNonSpringServletImpl.java

the custom implementation for the CXFNonSpringServlet.


 

web.xml


Source code can be downloaded at :- https://github.com/chathurangat/apache-cxf-jax-ws-first-service

Chathuranga Tennakoon
www.chathurangaonline.com
chathuranga.t@gmail.com

 

JDK 8 Failed to read schema document ‘xjc.xsd’, because ‘file’ access is not allowed due to restriction set by the accessExternalSchema property.

The error msg is:

java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:/path/to/glassfish/modules/jaxb-osgi.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document ‘xjc.xsd’, because ‘file’ access is not allowed due to restriction set by the accessExternalSchema property.

the resolution is:

Create a file named jaxp.properties (if it doesn’t exist) under /path/to/jdk1.8.0/jre/lib and then write this line in it:

src: https://stackoverflow.com/questions/23011547/webservice-client-generation-error-with-jdk8

How to modify a class file

You can follow these steps to modify your java class:

  1. Decompile the .class file as you have done and save it as .java
  2. Create a project in Eclipse with that java file, the original JAR as library, and all its dependencies
  3. Change the .java and compile
  4. Get the modified .class file and put it again inside the original JAR.

Spring Data is Transctional

Is the databse transaction active?