Comments (12)
Thanks, @bradykurtz. I was unable to reproduce this with the dependencies you listed and a standard @SpringBootApplication
configured application; i.e. no other annotations other than the @SpringBootApplication
.
I was, however, able to reproduce it when I added additional configuration to component scan of the org.springframework.content.solr
package. This forced the FullTextSolrIndexingConfig
configuration class (that you noted) to be loaded causing the issue.
So, I wonder if your application is somehow scanning this package? Perhaps you have a @ComponentScan("org.springframework.content.solr")
annotation or perhaps your application is re-using that package?
If it isn't that simple/obvious then maybe you could commit a small project in that reproduces the issue into your github org and point me at it? Then I can take a closer look and see if I can figure out what is going on there.
from spring-content.
@paulcwarren Thanks for responding so quickly. Your right I do not have just @SpringBootApplication. I do have have the following annotations:
@SpringBootApplication
@EnableMongoRepositories
@EnableMongoStores
@EnableFullTextSolrIndexing
@Import(HypermediaConfiguration.class)
I also pushed a demo (with instructions on how to run) of what I have so far to reproduce the error. You can find it here
Please let me know if you have any trouble. Thanks in advance for looking at this.
from spring-content.
Hi @bradykurtz, thanks for sharing that project. That was very helpful. So, yes it is the @EnableFullTextSolrIndexing
annotation. That isn't required when using spring boot. Boot adds this annotation for you and auto-configures solr beans when and only if you need them. Adding that annotation forces the creation of additional solr beans regardless, leading to bean resolution error.
In fact, you dont actually need @EnableMongoRepositories
or @EnableMongoStores
either. In essence, when using Spring Boot these features are automatically enabled or turned on by putting the relevant dependencies on the classpath. We usually only add these annotations when not using Spring Boot or when the need arises to override settings like basePackages
(that instructs Spring Data/Content where to look for Repositories/Stores).
Whilst testing I did actually find a bug in our search REST endpoint when used with mongodb (there is actually a gap in our test coverage that we will fix moving forwards) so if you are planning to submit searches via the search REST endpoint; i.e. GET <repository>/searchContent/findKeyword?keyword=
you may want to camp on 0.4.0-SNAPSHOT until we release 0.4.0. Apologies for that.
from spring-content.
@paulcwarren Thanks. I have removed the Enable Annotations in the repo. I also tried to update to 0.4.0-SNAPSHOT and I can't find that in the maven repo. My thought was to use the spring content REST endpoints. However since I could not update to 0.4.0-SNAPSHOT I setup a simple Rest Controller. I could Autowire my Mongo Repo in just fine but my ContentStore is not being picked up as a bean and thus I can not Autowire it. This is checked into the repo. I believe my dependencies are correct. I am stepping through the code now and If I can find my error I will let you know.
from spring-content.
You're right. SNAPSHOT versions are not available from maven central. Sorry! If you want 0.4.0-SNAPSHOT (or any build of head in fact) then you should add the following to your POM:
<repositories>
<repository>
<id>snapshots</id>
<name>nexus</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
from spring-content.
Thanks Paul. I was able to pull it down. Do you know why ContentStore beans are not able to be autowired?
I can see in the MongoContentAutoConfigureRegistrar the interface is picked up and added to the registry.
I am getting:
Method threw 'org.springframework.content.commons.repository.StoreAccessException' exception. Cannot evaluate com.sun.proxy.$Proxy88.toString()
from spring-content.
I think I know what is happening here. If you inspect a content store proxy (in intellij) the inspector popup does give you that weird proxy error. I think we need to add toString implementation on our store proxy class, or something like that. Will investigate. But actually if you drill down on that proxy you'll see it has a target correctly set to an instance of DefaultMongoStoreImpl
. So I think you are good. That proxy will implement your interface and when you make calls on it, the proxy will forward them onto the generic DefaultMongoStoreImpl implementation class.
As a test I also added the Spring Data/Content REST dependencies and was then able to use postman to add new assets, associate content with those assets and do fulltext searches.
from spring-content.
I fixed that second issue whilst on a plane yesterday and pushed to origin/master so it will be available to you if you use 0.4.0-SNAPSHOT and for your dependencies to update (mvn -U
).
Regardless, did you see your content store being auto-wired?
from spring-content.
I tested the auto-wire functionality before pulling down the latest snapshot. As you suspected it was autowiring correctly. I pulled down the latest snapshot and it fixed what I was seeing. Thanks so much. I am still working on successfully setting content. I am getting a solr error now (404 not found /solr/update/extract). This is my first time using solr so I am probably doing something wrong. It does appear to be getting father though now as expected.
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr: Expected mime type application/octet-stream but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/update/extract. Reason:
<pre> Not Found</pre></p>
</body>
</html>
from spring-content.
Yeah, solr is a whole thing. Perhaps, I can explain how we set up out acceptance tests. That might help.
Our acceptance tests download and use solr 7.5.0 (older 7.x version will likely work though) and start it with <solr install dir>/bin/solr start -e dih
. This starts solr with an example configuration that we know has the extraction handler configured. In this configuration is a core (index), also called 'solr'.
We configure the solr client bean to point to the solr instance and to the solr core; i.e.
@Bean
public SolrClient solrClient(){
return new HttpSolrClient.Builder("http://localhost:8983/solr/solr")).build();
}
where http://localhost:8983/solr
addresses the solr instance itself and the remaining solr
adfdresses the 'solr' core.
HTH
from spring-content.
Hi @bradykurtz. Where are we on this? Do you need more assistance at all? If not, ok if I close?
from spring-content.
Closing due to inactivity. Feel free to re-open if you need anything else.
from spring-content.
Related Issues (20)
- Do not include junit as compile dependency
- Exception with unsetContent using SB3 and SC3.0.4 JPA Starter HOT 1
- File download not working on windows platform HOT 1
- How do I configure com.github.paulcwarren:spring-content-bom for spring boot kotlin gradle? HOT 1
- Hibernate dependency error HOT 4
- No suitable HttpMessageConverter found to read request body into object of type class com.example.demo.entity.client.image.Avatar from request with content type of image/png;charset=UTF-8 HOT 8
- Investigation into the cause of `java.lang.NullPointerException: Cannot invoke "org.springframework.content.commons.storeservice.StoreInfo.getInterface()" because the return value of "internal.org.springframework.content.rest.io.StoreResource.getStoreInfo()" is null`
- Maven build error with Graal VM on Spring Content HOT 4
- Crash when use FileSystemResourceLoader in the latest version of spring boot HOT 1
- Not compatible with Spring Boot 3.2: method Assert.notNull(Object) does not exist HOT 2
- If-Match HTTP header gets ignored by a concurrent PUT after DELETE on the content of an entity HOT 1
- Filesize and filename are not set after a multipart/form POST http request to create entity with content HOT 1
- Events emitted twice HOT 2
- Relation "Blobs" not found HOT 2
- Multipart request to create entity and content in single request fails with http 400 HOT 1
- Multipart request to create entity and content in one request fail to create entity when file is missing
- Adding content to s3-storage fails with http 500 when using spring boot 3.2.1+ HOT 2
- Allow overriding name of content field in multipart payload
- Unable to Use Azure Data Storage in Springboot
- Unable to Use Azure Data Storage in Springboot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-content.