java.lang.IllegalArgumentException: No query defined for that name [Offices.getAllOffices] - jpa

I'm getting started with JavaEE and Wildfly(JBoss Server App.). My project is already operational, but, when I try to start my .xhtml page I receive an error from the server app.
Caused by: java.lang.IllegalArgumentException: No query defined for that name [Offices.getAllOffices]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

The error is pretty straight forward. I'll copy the clear part out separate to reflect it
No query defined for that name [Offices.getAllOffices]
You're likely using a named query in your code, referring to this name. This named query doesn't exist.

Related

After upgrading to postgresql 13.8 getting error the server does not support SSL

We have upgraded the postgresql version from 9.6 to 13.8 in our lab. Post upgrade and initialization our application is keep restarting due to the below error in the log 
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'migration': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'credentialedDataSource': Invocation of init method failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The server does not support SSL.)
What does the above error mean? How to fix it? Do we need to do anything with the server.crt and server.key files? Meaning, reimport or regenerate. 
Pls let me know if you need any other detail from me.
Just playing with the postgresql parameters in pg_hba.conf file
You need to carry the server.crt and server.key over from the old server to the new one (if you didn't already). You also need to change "ssl" parameter in the new postgresql.conf file, since you apparently haven't done so.
You should carefully consider the differences between the old postgresql.conf and the new one to decide how the differences should be resolved. 9.6 to 13 is a pretty big jump, and some parameters are new, some are obsolete, and some have changed their defaults or their meanings (or spellings).

scalaXB Async Dispatcher java.lang.IllegalStateException: failed to create a child event loop

I am using ScalaXB to make a call to a SOAP Web Service. I generated the code against WSDL using the following command
I am making a call to the web service in a loop. I notice that the code runs fine for sometime but then starts throwing the following error
java.lang.IllegalStateException: failed to create a child event loop
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:68)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:50)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:70)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:65)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:56)
at org.asynchttpclient.netty.channel.ChannelManager.<init>(ChannelManager.java:173)
at org.asynchttpclient.DefaultAsyncHttpClient.<init>(DefaultAsyncHttpClient.java:85)
at dispatch.Http.client$lzycompute(execution.scala:16)
at dispatch.Http.client(execution.scala:16)
at dispatch.Http.client(execution.scala:11)
at dispatch.HttpExecutor$class.apply(execution.scala:120)
at dispatch.Http.apply(execution.scala:11)
at dispatch.HttpExecutor$class.apply(execution.scala:115)
at dispatch.Http.apply(execution.scala:11)
at scalaxb.DispatchHttpClientsAsync$DispatchHttpClient$class.request(httpclients_dispatch_async.scala:22)
at scalaxb.DispatchHttpClientsAsync$$anon$1.request(httpclients_dispatch_async.scala:7)
at scalaxb.SoapClientsAsync$SoapClientAsync$class.soapRequest(soap12_async.scala:43)
at scalaxb.SoapClientsAsync$$anon$1.soapRequest(soap12_async.scala:24)
at scalaxb.SoapClientsAsync$SoapClientAsync$class.requestResponse(soap12_async.scala:63)
at scalaxb.SoapClientsAsync$$anon$1.requestResponse(soap12_async.scala:24)
Caused by: io.netty.channel.ChannelException: failed to open a new selector
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:176)
at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:150)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:103)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)
... 34 more
Caused by: java.io.IOException: Too many open files in system
at sun.nio.ch.KQueueArrayWrapper.init(Native Method)
at sun.nio.ch.KQueueArrayWrapper.<init>(KQueueArrayWrapper.java:98)
at sun.nio.ch.KQueueSelectorImpl.<init>(KQueueSelectorImpl.java:88)
at sun.nio.ch.KQueueSelectorProvider.openSelector(KQueueSelectorProvider.java:42)
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:174)
... 37 more
I found out the answer to this question. The problem was that I was doing a new on the proxy object inside of the loop.
It seems that these objects create a new connection and don't get cleaned up resulting in the error above.
I moved the proxy object out of the loop and just called the webservice inside the loop and the problem got resolved.

D2FS within workflow method

I´m trying to use D2FS services within a workflow method, but im getting the following error:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "address". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
at javax.xml.ws.wsaddressing.W3CEndpointReference
Two classes have the same XML type name "elements". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
at javax.xml.ws.wsaddressing.W3CEndpointReference
I tried to update the jaxws-rt libraries and started getting the new error:
java.lang.LinkageError: ClassException: attempting to castjar:file:/C:/Documentum/jboss4.3.0/server/DctmServer_MethodServer/deploy/bpm.ear/APP-INF/lib/jaxws-api.jar!/javax/xml/ws/spi/Provider.classtojar:file:/C:/Documentum/jboss4.3.0/jdk/jre/lib/rt.jar!/javax/xml/ws/spi/Provider.class
at javax.xml.ws.spi.Provider.provider(Provider.java:94)
at javax.xml.ws.Service.<init>(Service.java:56)
at com.emc.d2fs.schemas.models.ModelPortService.<init>(ModelPortService.java:46)
at com.emc.cgd.methodsWorkflow.DispatchExtStorageUpdateData.doTask(DispatchExtStorageUpdateData.java:45)
at com.documentum.bpm.rtutil.WorkflowMethod.execute(WorkflowMethod.java:214)
at com.documentum.bpm.rtutil.AbstractWorkflowMethod.executeMethod(AbstractWorkflowMethod.java:27)
at com.documentum.bpm.rtutil.GenericWorkflowMethod.execute(GenericWorkflowMethod.java:124)
at com.documentum.bpm.rtutil.GenericWorkflowMethod.execute(GenericWorkflowMethod.java:65)
at com.documentum.mthdservlet.DfMethodRunner.runIt(Unknown Source)
at com.documentum.mthdservlet.AMethodRunner.runAndReturnStatus(Unknown Source)
Any idea how to solve it?
Im using:
JBoss 4.3
JAX-WS Implementation 2.2
Thanks
On tomcat I had to add following jars to the tomcat lib:
jaxws-api.jar
jaxws-rt.jar
stax-ex.jar
streambuffer.jar
Perhaps this will resolver the problem on jBoss as well.

Spring GroovyDynamicElementReader tries to read a Groovy script as XML and fails

When I looked at Spring Boot, I liked the idea that it:
Gets out of the way quickly if you want to change defaults. - Dave Syer, Spring One 2GX 2013
It wasn't long before practicality hit me. While trying to make Boot work with a 100% Groovy/no-XML pet project, I found 2 issues in 2 days. Here's one of them.
Groovy config file:
beans {
xmlns([ctx:'http://www.springframework.org/schema/context'])
ctx.'component-scan'('base-package':'name.abhijitsarkar.moviedatabase')
}
Exception:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read XML document; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unable to determine validation mode for [Groovy]: cannot open InputStream. Did you attempt to load directly from a SAX InputSource without specifying the validationMode on your XmlBeanDefinitionReader instance?; nested exception is java.io.FileNotFoundException: Groovy cannot be opened because it does not point to a readable resource
at org.springframework.beans.factory.xml.XmlReaderContext.readDocumentFromString(XmlReaderContext.java:98)
at org.springframework.beans.factory.xml.XmlReaderContext$readDocumentFromString.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.springframework.beans.factory.groovy.GroovyDynamicElementReader.invokeMethod(GroovyDynamicElementReader.groovy:96)
Also posted on Spring forum.

Spring data using Neo4j and MongoDB

I am just about to go crazy,I just spent many hours to try work with spring-data for Neo4J,working with spring-data for MongoDB was a walk in the park compared to that.
My goals: 1) Working with spring-data to manage two data-stores Mongo,Neo4j.
(correct me if I am wrong but there is no spring-data cross data store support for these two, which mean I will use different domain entities for each store)
2) Working with Neo4J embedded graph.
3) Will have the ability to monitor the graph with some client like the web admin.
So I started with Good Relationship spring-data example
, where using :
POM
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
XML
<neo4j:config storeDirectory="data/graph.db"/>
So my first question is how can I monitor the graph In that configuration, in which client?
So I read more and I got to Neo4j Web Admin for embedded graph configuration
I followed every step tried it and boom!
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.haze.server.repository.mongo.ProfileRepository com.haze.server.services.ProfileServices.profileRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'profileRepository': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: org.springframework.data.repository.core.RepositoryMetadata.getDomainClass()Ljava/lang/Class;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
... 39 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'profileRepository': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: org.springframework.data.repository.core.RepositoryMetadata.getDomainClass()Ljava/lang/Class;
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
... 41 more
Caused by: java.lang.NoSuchMethodError: org.springframework.data.repository.core.RepositoryMetadata.getDomainClass()Ljava/lang/Class;
at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getTargetRepository(MongoRepositoryFactory.java:84)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:137)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:125)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:41)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 49 more
Make long story short the only version configuration I find to get spring context to load is
<spring.data.mongo.version>1.0.4.RELEASE</spring.data.mongo.version>
<neo4j.version>1.6</neo4j.version>
<spring-data-neo4j.version>2.0.1.RELEASE</spring-data-neo4j.version>
If I am adding the below dependency like specify in the article it crashed.
<spring-data-commons-core.version>1.3.0.RELEASE</spring-data-commons-core.version>
Ok so I got it working after many hours with the neo4j embedded graph and the server wrapper in order to monitor the graph from the web admin with mongo as my primary datastore.
Kind of happy but sad cause using old version for the neo4j server wrapper (1.6 cause that is the only thing which worked) I was motivated to start working with the graph via spring-data.
So I got the most basic node entity:
#NodeEntity
public class ProfileNode {
#GraphId
private Long id;
#Indexed(unique = true)
private String pid = null;
}
Tried some basic operations:
// save node - OK
ProfileNode node = new ProfileNode();
node.setPid("44ed79b3ea8a99117aa601b16e916ddr");
ProfileNode profile = graphRepo.save(node);
// return NULL
node = graphRepo.findByPropertyValue("pid",
"44ed79b3ea8a99117aa601b16e916ddr");
// throwing exception - java.lang.UnsupportedOperationException:read only index
graphRepo.delete(profile);
Basically almost every basic operation I tried didn't worked for me.
I don't know if the problems occur because of my mishmash configurations or that I am doing something wrong In my code, can someone please help me configure my application or let me know why the most basic operation via spring data doesn't work for me?
Thanks.
Please update to 2.1.RC4 as Lasse said.
Regarding using the embedded server with SDN, it is described in the docs.
What does your repository look like?
You really should upgrade to SDN 2.1.RC4, it will be out as GA in a metter of weeks.
Secondly, here is some code to get you started: https://github.com/SpringSource/spring-data-neo4j/blob/master/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/DerivedFinderTests.java - you can add a test for findByPropertyValue if you are not keen on derived finders, but at least this works out of the box using just that single file, i.e. you can eliminate Spring config as a source of errors.
For cross-store: I see little point in cross-store with MongoDB, to me cross-store is all about transactions across multiple data sources. With MongoDB + Neo, I'd just build different repositories and on the application level do just enough to use them concurrently.
You have to have spring-data-mongodb-1.1.0.RC1 and spring-data-neo4j-2.1.0.RC4. Both of those have the same spring-data-commons-core dependency.
spring-data with neo4j + mongo version conflicts