I am trying to generate a webservice using CFX in Grails.
I have added compile ":cxf:2.1.1" to BuildConfig.groovy and created a service:
package servicetest
import grails.transaction.Transactional
import javax.jws.*;
import org.grails.cxf.utils.EndpointType
#Transactional
class TestService {
static expose = EndpointType.JAX_WS
#WebMethod( operationName="createUpdateUser" )
#WebResult( name="result" )
def serviceMethod() {
}
}
This works ok. However, I want to change the target namespace in the generated WSDL. To do this, I add #WebService:
package servicetest
import grails.transaction.Transactional
import javax.jws.*;
import org.grails.cxf.utils.EndpointType
#Transactional
#WebService(name = 'CustomerServiceWsdlEndpoint',
targetNamespace = 'http://test.cxf.grails.org/',
serviceName = 'CustomerServiceWsdlEndpoint',
portName = 'CustomerServiceWsdlPort')
class TestService {
static expose = EndpointType.JAX_WS
#WebMethod( operationName="createUpdateUser" )
#WebResult( name="result" )
def serviceMethod() {
}
}
However, when I start the Grails app, I get the following error message:
|Running Grails application
Error |
2015-12-04 11:21:07,506 [localhost-startStop-1] ERROR [localhost].[/ServiceTest] - StandardWrapper.Throwable
Message: Error creating bean with name 'testServiceBean': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.apache.cxf.endpoint.Server org.apache.cxf.jaxws.JaxWsServerFactoryBean.create()] threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
Line | Method
->> 593 | createApplicationContext in grails.spring.BeanBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 53 | loadAdditionalConfig in org.grails.cxf.servlet.GrailsCxfServlet
| 25 | init . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
Caused by BeanDefinitionStoreException: Factory method [public org.apache.cxf.endpoint.Server org.apache.cxf.jaxws.JaxWsServerFactoryBean.create()] threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
->> 593 | createApplicationContext in grails.spring.BeanBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 53 | loadAdditionalConfig in org.grails.cxf.servlet.GrailsCxfServlet
| 25 | init . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
Caused by ServiceConstructionException: null
->> 336 | initialize in org.apache.cxf.jaxb.JAXBDataBinding
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 467 | buildServiceFromClass . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 712 | buildServiceFromClass in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 527 | initializeServiceModel . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 261 | create in ''
| 215 | create . . . . . . . . . in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 102 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 159 | create . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 211 | create in org.apache.cxf.jaxws.JaxWsServerFactoryBean
| 593 | createApplicationContext in grails.spring.BeanBuilder
| 53 | loadAdditionalConfig in org.grails.cxf.servlet.GrailsCxfServlet
| 25 | init . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
Caused by IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
->> 106 | check in com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 460 | getTypeInfoSet in com.sun.xml.bind.v2.runtime.JAXBContextImpl
| 292 | <init> . . . . . . . . . in ''
| 139 | <init> in ''
| 1138 | build . . . . . . . . . in com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder
| 162 | createContext in com.sun.xml.bind.v2.ContextFactory
| 248 | newInstance . . . . . . in javax.xml.bind.ContextFinder
| 235 | newInstance in ''
| 432 | find . . . . . . . . . . in ''
| 637 | newInstance in javax.xml.bind.JAXBContext
| 347 | run . . . . . . . . . . in org.apache.cxf.common.jaxb.JAXBContextCache$2
| 345 | run in ''
| 246 | getCachedContextAndSchemas in org.apache.cxf.common.jaxb.JAXBContextCache
| 479 | createJAXBContextAndSchemas in org.apache.cxf.jaxb.JAXBDataBinding
| 334 | initialize . . . . . . . in ''
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 467 | buildServiceFromClass . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 712 | buildServiceFromClass in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 527 | initializeServiceModel . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 261 | create in ''
| 215 | create . . . . . . . . . in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 102 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 159 | create . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 211 | create in org.apache.cxf.jaxws.JaxWsServerFactoryBean
| 593 | createApplicationContext in grails.spring.BeanBuilder
| 53 | loadAdditionalConfig in org.grails.cxf.servlet.GrailsCxfServlet
| 25 | init . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
Error |
2015-12-04 11:21:07,595 [localhost-startStop-1] ERROR [localhost].[/ServiceTest] - Servlet /ServiceTest threw load() exception
Message: 1 counts of IllegalAnnotationExceptions
Line | Method
->> 106 | check in com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 460 | getTypeInfoSet in com.sun.xml.bind.v2.runtime.JAXBContextImpl
| 292 | <init> . . . . . . . . . . in ''
| 139 | <init> in ''
| 1138 | build . . . . . . . . . . . in com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder
| 162 | createContext in com.sun.xml.bind.v2.ContextFactory
| 248 | newInstance . . . . . . . . in javax.xml.bind.ContextFinder
| 235 | newInstance in ''
| 432 | find . . . . . . . . . . . in ''
| 637 | newInstance in javax.xml.bind.JAXBContext
| 347 | run . . . . . . . . . . . . in org.apache.cxf.common.jaxb.JAXBContextCache$2
| 345 | run in ''
| 246 | getCachedContextAndSchemas in org.apache.cxf.common.jaxb.JAXBContextCache
| 479 | createJAXBContextAndSchemas in org.apache.cxf.jaxb.JAXBDataBinding
| 334 | initialize . . . . . . . . in ''
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 467 | buildServiceFromClass . . . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 712 | buildServiceFromClass in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 527 | initializeServiceModel . . in org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
| 261 | create in ''
| 215 | create . . . . . . . . . . in org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
| 102 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 159 | create . . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 211 | create in org.apache.cxf.jaxws.JaxWsServerFactoryBean
| 593 | createApplicationContext . in grails.spring.BeanBuilder
| 53 | loadAdditionalConfig in org.grails.cxf.servlet.GrailsCxfServlet
| 25 | init . . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . . in java.lang.Thread
Can someone tell me what I am doing wrong, or if there is another way to set the target namespace?
Thanks,
Carl
To solve problem you need to create an interface which is a webservice and then implement it in your service class.
#WebService
interface TestServiceInterface {
def serviceMethod()
}
#WebService(name = 'CustomerServiceWsdlEndpoint',
targetNamespace = 'http://test.cxf.grails.org/',
serviceName = 'CustomerServiceWsdlEndpoint',
portName = 'CustomerServiceWsdlPort')
class TestService implements TestServiceInterface {
static expose = EndpointType.JAX_WS
#WebMethod( operationName="createUpdateUser" )
#WebResult( name="result" )
def serviceMethod() {
}
}
For more information go to link
Related
I have an s3 bucket that I structured using the format s3://<bucket-name>/year=<yearno>/month=<monthno>/day=<dayno>/<filename>.log. The lines in the .log files that I've got is structured like:
2020-01-06 09:05:14,450 INFO [Asterisk-Java DaemonPool-1-thread-3] handler.CallHandler (CallHandler.java:849) - Original name : harris changed to : haris . Exist? true
While the Grok pattern that I'm using for the classifier is:
[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9:,]{12} INFO \[Asterisk-Java DaemonPool-1-thread-[0-9]{1,3}] handler.CallHandler \(CallHandler.java:849\) - Original name : %{WORD:original_name} changed to : %{WORD:transformed_name} . Exist\? %{WORD:exist_prior}
I checked my Grok pattern using this debugger web app, and it's confirmed to be correct. What I expected the resulting table to be:
+------+-------+-----+---------------+------------------+--------------+
| year | month | day | original_name | transformed_name | exists_prior |
+------+-------+-----+---------------+------------------+--------------+
| - | - | - | - | - | - |
+------+-------+-----+---------------+------------------+--------------+
However, the table that I've gotten is:
+------+-------+-----+------+------+------+------+
| year | month | day | col0 | col1 | col2 | col3 |
+------+-------+-----+------+------+------+------+
| - | - | - | - | - | - | - |
+------+-------+-----+------+------+------+------+
Where did I go wrong?
I changed my capture regex from %{WORD:variable_name} to %{DATA:variable_name}. It then worked as expected.
I am using a window function to get the difference in the values of a column (downloads) between two dates. I'd also like to get the product of that difference multiplied by the size of the file to get the bytes downloaded for the period.
With the help of this community, I am able to get the number of downloads but cannot find the correct syntax to get the product of downloads * size.
Table 'files'
+---------------+------------------------+------+-----------+------------+
| site | full_path | size | downloads | date_stamp |
+---------------+------------------------+------+-----------+------------+
| Lawrenceville | lr1/dir1/subdir1/file1 | 1000 | 7 | 2019-08-08 |
| Lawrenceville | lr1/dir1/subdir1/file1 | 1010 | 9 | 2019-08-15 |
| Lawrenceville | lr1/dir1/subdir1/file2 | 1213 | 5 | 2019-08-08 |
| Lawrenceville | lr1/dir1/subdir1/file2 | 2000 | 5 | 2019-08-15 |
| Lawrenceville | lr1/dir2/subdir1/file1 | 2213 | 5 | 2019-08-15 |
| Rennes | rr1/dir1/subdir1/file3 | 200 | 3 | 2019-08-08 |
| Rennes | rr1/dir1/subdir1/file3 | 201 | 4 | 2019-08-15 |
+---------------+------------------------+------+-----------+------------+
SELECT site, sum(diff) FROM (SELECT site, downloads - lag(downloads, 1) OVER (PARTITION BY site, full_path ORDER BY date_stamp) AS diff FROM files WHERE date_stamp IN ('2019-08-15', '2019-08-08')) group by site
produces this:
+---------------+-----------+
| site | downloads |
+---------------+-----------+
| Lawrenceville | 2 |
| Rennes | 1 |
+---------------+-----------+
I have tried:
SELECT site, sum(diff), sum(sum(diff)*bytes) FROM (SELECT site, downloads - lag(downloads, 1), size OVER (PARTITION BY site, full_path ORDER BY date_stamp) AS diff, bytes FROM files WHERE date_stamp IN ('2019-08-15', '2019-08-08')) group by site
sqlite3.OperationalError: near "(": syntax error
Ideally I want this output:
+---------------+-----------+----------+
| site | downloads | bytes |
+---------------+-----------+----------+
| Lawrenceville | 2 | 2020 |
| Rennes | 1 | 201 |
+---------------+-----------+----------+
Lawrenceville had 2 downloads of file lr1/dir1/subdir1/file1 which is 1010 bytes (on 2019-08-15). File lr1/dir1/subdir1/file2 had no downloads for that period. It would be nice to include files lr1/dir1/subdir1/file2 and lr1/dir2/subdir1/file1 but they get excluded by the window function. I can get them with a separate query.
Rennes has 1 download of file rr1/dir1/subdir1/file3
If your current query works then you only need max() window function in the subquery:
SELECT site, sum(diff) downloads, sum(diff) * size bytes
FROM (
SELECT
site,
downloads - lag(downloads, 1) OVER (PARTITION BY site, full_path ORDER BY date_stamp) AS diff,
max(size) OVER (PARTITION BY site, full_path) AS size
FROM files
WHERE date_stamp IN ('2019-08-15', '2019-08-08')
)
group by site
See the demo.
Results:
| site | downloads | bytes |
| ------------- | --------- | ----- |
| Lawrenceville | 2 | 2020 |
| Rennes | 1 | 201 |
So I'm building out a database where I need to have a field related to a specific ManyToMany relationship, but I don't know how to translate this into the Django ORM. For example, I have multiple Articles that can go with multiple Publications, but I want to see which article got the most views.
I figure that I could build the database like so:
+------------+--------+--------+-------+
| art_pub_id | art_id | pub_id | views |
+------------+--------+--------+-------+
| 101 | 201 | 301 | 6 |
+------------+--------+--------+-------+
| 102 | 201 | 302 | 4 |
+------------+--------+--------+-------+
| 103 | 202 | 301 | 8 |
+------------+--------+--------+-------+
Or I could do this
+------------+--------+--------+
| art_pub_id | art_id | pub_id |
+------------+--------+--------+
| 101 | 201 | 301 |
+------------+--------+--------+
| 102 | 201 | 302 |
+------------+--------+--------+
| 103 | 202 | 301 |
+------------+--------+--------+
+----+------------+-------+
| pk | art_pub_id | views |
+----+------------+-------+
| 1 | 101 | 6 |
+----+------------+-------+
| 2 | 102 | 4 |
+----+------------+-------+
| 3 | 103 | 8 |
+----+------------+-------+
I'm struggling with how to translate this to the Django ORM. I have the Article with the ManyToManyField pointing to the Publication, but I don't know where or how to place the views IntegerField. I have tried having a Publication_Article class that has two ManyToMany fields and my views field, but I'm not sure that is the right way to be doing it.
I also fully recognize that I may be approaching the problem wrong with my database design, in which case knowing the best way to do this would be invaluable for me.
I'm using Doctrine 2 with my ZF2 project, but i'm getting some weird problem with my server CPU and memory. And my server simply crashes.
I'm getting a lot of sleep state querys and they seem not to get cleaned.
mysql> show processlist;
+---------+--------------+-----------+------------------+----------------+------+--------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+--------------+-----------+------------------+----------------+------+--------------------+------------------------------------------------------------------------------------------------------+
| 2832346 | leechprotect | localhost | leechprotect | Sleep | 197 | | NULL |
| 2832629 | db_user | localhost | db_exemple | Sleep | 3 | | NULL |
| 2832643 | db_user | localhost | db_exemple | Sleep | 3 | | NULL |
| 2832646 | db_user | localhost | db_exemple | Sleep | 3 | | NULL |
| 2832664 | db_user | localhost | db_exemple | Sleep | 154 | | NULL |
| 2832666 | db_user | localhost | db_exemple | Sleep | 153 | | NULL |
| 2832669 | db_user | localhost | db_exemple | Sleep | 152 | | NULL |
| 2832674 | db_user | localhost | db_exemple | Sleep | 7 | | NULL |
| 2832681 | db_user | localhost | db_exemple | Sleep | 1 | | NULL |
| 2832683 | db_user | localhost | db_exemple | Sleep | 4 | | NULL |
| 2832690 | db_user | localhost | db_exemple | Sleep | 149 | | NULL |
(.......)
Also, it seems php GC is not cleaning all the objects from memory, or even kill processes.
Is there a way to disable the cache system? Would it improve the use of my resorces=
Most my querys are similar to:
$query = $this->createQueryBuilder('i');
$query->innerJoin('\Application\Relation', 'r', 'WITH', 'r.child = i.id');
$query->innerJoin('\Application\Taxonomy', 't', 'WITH', 't.id = r.taxonomy');
$query->where('t.type = :type')->setParameter('type', $relation);
$query->groupBy('i.id');
$items = $query->getQuery()->getResult(2);
Thanks in advance.
Firstly check the mysql's wait_timout variable. From the documentation:
Wait_timeout : The number of seconds the server waits for activity on
a noninteractive connection before closing it.
In normal flow (which not using persistent connections), php closes the connection automatically after script execution. To ensure there are no sleeping threads; at the end of your script simply close the connection:
$entityManager->getConnection()->close();
If these queries are running in a big while/for loop, you might want to read doctrine 2 batch processing documentation.
I'm trying to create a web service using Grails and Apache CXF, naturally using the CXF-Grails plugin. I created a simple service called Test Service
package testcxf
class TestService {
static expose = ['cxf']
String echoString(String str) {
return str
}
String reverseString(String str) {
return str.reverse()
}
}
This service works exactly as expected and a test client successfully called the echo and reverse methods. Next I created a simple domain class called Person
package testcxf
class Person {
String name
String city
int age
static constraints = {
}
}
And revised the service with some basic functions to interact with the domain.
package testcxf
class TestService {
static expose = ['cxf']
String echoString(String str) {
return str
}
String reverseString(String str) {
return str.reverse()
}
void addPerson(Person person) {
person.save()
}
Person getPerson(String name) {
return Person.findByName(name)
}
List<Person> getAllPeople() {
return Person.findAll()
}
}
That's when it all fell apart. When calling grails run-app I received the following exception. The application did complete startup but the wsdl that was generated was incomplete and lacked all definitions of the complex type Person.
| Error 2012-05-01 20:51:03,504 [pool-7-thread-1] ERROR [localhost].[/TestCxf] - StandardWrapper.Throwable
Message: Error creating bean with name 'testServiceBean': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.apache.cxf.endpoint.Server org.apache.cxf.frontend.ServerFactoryBean.create()] threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
Line | Method
->> 578 | createApplicationContext in grails.spring.BeanBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 57 | loadAdditionalConfig in org.grails.cxf.GrailsCXFServlet
| 40 | init . . . . . . . . . . in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . . . . . . . . in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Caused by BeanDefinitionStoreException: Factory method [public org.apache.cxf.endpoint.Server org.apache.cxf.frontend.ServerFactoryBean.create()] threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
->> 578 | createApplicationContext in grails.spring.BeanBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 57 | loadAdditionalConfig in org.grails.cxf.GrailsCXFServlet
| 40 | init . . . . . . . . . . in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . . . . . . . . in java.util.concurrent.FutureTask
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Caused by ServiceConstructionException: null
->> 341 | initialize in org.apache.cxf.jaxb.JAXBDataBinding
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 442 | buildServiceFromClass . in org.apache.cxf.service.factory.ReflectionServiceFactoryBean
| 505 | initializeServiceModel in ''
| 242 | create . . . . . . . . . in ''
| 101 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 148 | create . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 578 | createApplicationContext in grails.spring.BeanBuilder
| 57 | loadAdditionalConfig . . in org.grails.cxf.GrailsCXFServlet
| 40 | init in ''
| 334 | innerRun . . . . . . . . in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . in java.lang.Thread
Caused by IllegalAnnotationsException: 5 counts of IllegalAnnotationExceptions
->> 102 | check in com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 472 | getTypeInfoSet in com.sun.xml.bind.v2.runtime.JAXBContextImpl
| 302 | <init> . . . . . . . . . in ''
| 1140 | build in com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder
| 154 | createContext . . . . . in com.sun.xml.bind.v2.ContextFactory
| 121 | createContext in ''
| 248 | newInstance . . . . . . in javax.xml.bind.ContextFinder
| 235 | newInstance in ''
| 432 | find . . . . . . . . . . in ''
| 637 | newInstance in javax.xml.bind.JAXBContext
| 564 | createContext . . . . . in org.apache.cxf.jaxb.JAXBDataBinding
| 504 | createJAXBContextAndSchemas in ''
| 324 | initialize . . . . . . . in ''
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 442 | buildServiceFromClass . in org.apache.cxf.service.factory.ReflectionServiceFactoryBean
| 505 | initializeServiceModel in ''
| 242 | create . . . . . . . . . in ''
| 101 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 148 | create . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 578 | createApplicationContext in grails.spring.BeanBuilder
| 57 | loadAdditionalConfig . . in org.grails.cxf.GrailsCXFServlet
| 40 | init in ''
| 334 | innerRun . . . . . . . . in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . in java.lang.Thread
| Error 2012-05-01 20:51:03,570 [pool-7-thread-1] ERROR [localhost].[/TestCxf] - Servlet /TestCxf threw load() exception
Message: 5 counts of IllegalAnnotationExceptions
Line | Method
->> 102 | check in com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 472 | getTypeInfoSet in com.sun.xml.bind.v2.runtime.JAXBContextImpl
| 302 | <init> . . . . . . . . . . in ''
| 1140 | build in com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder
| 154 | createContext . . . . . . . in com.sun.xml.bind.v2.ContextFactory
| 121 | createContext in ''
| 248 | newInstance . . . . . . . . in javax.xml.bind.ContextFinder
| 235 | newInstance in ''
| 432 | find . . . . . . . . . . . in ''
| 637 | newInstance in javax.xml.bind.JAXBContext
| 564 | createContext . . . . . . . in org.apache.cxf.jaxb.JAXBDataBinding
| 504 | createJAXBContextAndSchemas in ''
| 324 | initialize . . . . . . . . in ''
| 86 | initializeDataBindings in org.apache.cxf.service.factory.AbstractServiceFactoryBean
| 442 | buildServiceFromClass . . . in org.apache.cxf.service.factory.ReflectionServiceFactoryBean
| 505 | initializeServiceModel in ''
| 242 | create . . . . . . . . . . in ''
| 101 | createEndpoint in org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory
| 148 | create . . . . . . . . . . in org.apache.cxf.frontend.ServerFactoryBean
| 578 | createApplicationContext in grails.spring.BeanBuilder
| 57 | loadAdditionalConfig . . . in org.grails.cxf.GrailsCXFServlet
| 40 | init in ''
| 334 | innerRun . . . . . . . . . in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1110 | runWorker . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . . . in java.lang.Thread
Looking at the cxf plugin info page I found this:
Note that any classes being returned or passed as parameters
must be annotated with #XmlAccessorType(XmlAccessType.FIELD)
#XmlAccessorType(XmlAccessType.FIELD)
class Person {
....
}
-----EDIT-----
This one bothered me a lot because it should be so simple. I don't know if you ever got it working but here is what I had to do:
package testcxf
import javax.xml.bind.annotation.*
#XmlRootElement(name="person")
#XmlAccessorType(XmlAccessType.NONE)
#XmlType(propOrder = ["name","city","age"])
class Person {
#XmlElement
String name
#XmlElement
String city
#XmlElement
int age
static constraints = {
}
}
It would throw the same error you were receiving with any XmlAccessorType except NONE. Then in order to get the fields available I had to add the #XmlElement annotation.
Now it runs without the error and the WSDL contains the details of the Person object:
<xs:element name="person" type="tns:person"/>
<xs:complexType name="person">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="xs:string"/>
<xs:element minOccurs="0" name="city" type="xs:string"/>
<xs:element name="age" type="xs:int"/>
</xs:sequence>
</xs:complexType>