2016-04-05 7 views
0

MongoDB ile bahar mvc projemde garip bir hata alıyorum.Spring MVC ve MogoTemplate

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.StackOverflowError 
org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1302) 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:977) 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968) 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) 
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) 

root cause 

java.lang.StackOverflowError 
    java.security.AccessController.doPrivileged(Native Method) 
    java.io.FilePermission.init(FilePermission.java:209) 
    java.io.FilePermission.<init>(FilePermission.java:285) 
    sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:225) 
    sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:156) 
    sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:126) 
    sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:81) 
    sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122) 
    sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150) 
    java.net.URL.openStream(URL.java:1041) 
    java.lang.ClassLoader.getSystemResourceAsStream(ClassLoader.java:1372) 
    java.lang.Class.getResourceAsStream(Class.java:2109) 
    org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:101) 
    org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:87) 
    org.springframework.core.PrioritizedParameterNameDiscoverer.getParameterNames(PrioritizedParameterNameDiscoverer.java:65) 
    org.springframework.data.mapping.model.PreferredConstructorDiscoverer.buildPreferredConstructor(PreferredConstructorDiscoverer.java:109) 
    org.springframework.data.mapping.model.PreferredConstructorDiscoverer.<init>(PreferredConstructorDiscoverer.java:74) 
    org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:92) 
    org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity.<init>(BasicMongoPersistentEntity.java:75) 
    org.springframework.data.mongodb.core.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:91) 
    org.springframework.data.mongodb.core.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:39) 
    org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:299) 
    org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:489) 
    org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:446) 
    org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:689) 
    org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:314) 
: Ben bu hatayı alıyorum webapp için erişmeye çalıştığınızda,

public class InterventionsModel{ 

@NotNull 
public String title; 

@NotNull 
public String doneBy; 

@NotNull 
@DateTimeFormat(pattern="dd/MM/yyyy") 
public Date doneAt; 

@NotNull 
public TextArea desc; 



public String getTitle() { 
    return title; 
} 



public void setTitle(String title) { 
    this.title = title; 
} 



public String getDoneBy() { 
    return doneBy; 
} 



public void setDoneBy(String doneBy) { 
    this.doneBy = doneBy; 
} 



public Date getDoneAt() { 
    return doneAt; 
} 



public void setDoneAt(Date doneAt) { 
    this.doneAt = doneAt; 
} 



public TextArea getDesc() { 
    return desc; 
} 



public void setDesc(TextArea desc) { 
    this.desc = desc; 
} 


public InterventionsModel(){ 

} 

Ben sunucuyu sunucu her başlattığınızda:

@Document(collection = "equipements") 
public class EquipementModel { 

@Id 
private String id; 

@NotEmpty(message = "Please provide a name") 
@Size(min = 2, max = 10, message = "The name size must be between 2 and 10 characters") 
public String name; 

@NotEmpty(message = "Please provide the OS/iOs ofthe equipement") 
public String os; 

@NotEmpty(message = "Please provide the version of the equipement") 
@Size(min = 2, message = "The version size must contains atleast 2 characters") 
public String version; 

@NotEmpty(message = "Please select atleast one function") 
public ArrayList<String> functions; 

@NotEmpty(message = "Please select the category of the equipement") 
public String category; 

@NotEmpty(message = "Please provide the private IP") 
public String privateIp; 

public String publicIp; 

@NotEmpty(message = "Please specify the hardware") 
public String hardware; 

@NotEmpty(message = "Please specify the hardware type") 
public String hardwareType; 

@NotEmpty(message = "Please provide the authentication method") 
public String authMethod; 

@DateTimeFormat(pattern="dd/MM/yyyy") 
public Date addedDate; 

public List<InterventionsModel> interventions; 
public String getId() { 
    return id; 
} 

public void setId(String id) { 
    this.id = id; 
} 

public String getName() { 
    return name; 
} 

public void setName(String name) { 
    this.name = name; 
} 

public String getOs() { 
    return os; 
} 

public void setOs(String os) { 
    this.os = os; 
} 

public String getVersion() { 
    return version; 
} 

public void setVersion(String version) { 
    this.version = version; 
} 

public String getHardware() { 
    return hardware; 
} 

public void setHardware(String hardware) { 
    this.hardware = hardware; 
} 

public String getHardwareType() { 
    return hardwareType; 
} 

public void setHardwareType(String hardwareType) { 
    this.hardwareType = hardwareType; 
} 

public String getAuthMethod() { 
    return authMethod; 
} 

public void setAuthMethod(String authMethod) { 
    this.authMethod = authMethod; 
} 

public String getCategory() { 
    return category; 
} 

public void setCategory(String category) { 
    this.category = category; 
} 

public Date getAddedDate() { 
    return addedDate; 
} 

public void setAddedDate(Date addedDate) { 
    this.addedDate = addedDate; 
} 

public ArrayList<String> getFunctions() { 
    return functions; 
} 

public void setFunctions(ArrayList<String> functions) { 
    this.functions = functions; 
} 

public String getPrivateIp() { 
    return privateIp; 
} 

public void setPrivateIp(String privateIp) { 
    this.privateIp = privateIp; 
} 

public String getPublicIp() { 
    return publicIp; 
} 

public void setPublicIp(String publicIp) { 
    this.publicIp = publicIp; 
} 

public List<InterventionsModel> getInterventions() { 
    return interventions; 
} 

public void setInterventions(ArrayList<InterventionsModel> interventions) { 
    this.interventions = interventions; 
} 

public EquipementModel() { 

    } 

} 

Ve bu modeli: ben bu modeli var

Bu hata, yalnızca tüm ekipmanların listelenmesi gereken ilk sayfada görüntülenir, burada sorgu şu şekildedir:

@Repository 
public class EquipementService { 

    @Autowired 
    private MongoTemplate mongoTemplate; 

public List<EquipementModel> listEquipement() { 
     Query query = new Query(); 
     query.with(new Sort(Sort.Direction.ASC, "name")); 
     return mongoTemplate.find(query, EquipementModel.class); 
    } 

Ama Equipement Modeli gelen müdahaleler alanında çıkartırsanız, her şey gayet iyi çalışıyor fark ....

Belki bazı ek açıklama eksik?

Yardımınız için teşekkürler, bazı günler için gerçekten bloke oldum.

+0

bu 'EquipementModel' tam sürümü var: Sen ise -Xss Tartışmanın -Xss flag.The biçimini kullanarak iş parçacığı yığın boyutunu artırabilir? Değilse, eksik parçaları ekleyin –

+0

EquipementModel –

+0

eksik bölümünü ekledim InterventionsModel kodunu da tamamlayın –

cevap

0

En basit neden yığın izlemenin dikkatsiz kullanımıdır. Kod, yinelemeli olarak olarak adlandırılıyor. Bu iki sınıf arasında dairesel bağımlılık var. Bu satırları tespit ettiniz.

VEYA Yüklenmiş Java Sanal Makinesi'ne (JVM) bağlı olarak, varsayılan iş parçacığı yığın boyutu 512 KB veya 1 MB'ye eşit olabilir.

-Xss<size>[g|G|m|M|k|K] 
+0

Bu benim de öğrendiğim gibi, ama JVM parametrelerini zaten değiştirdim ve hala aynı şey –

+0

IntipentionsModel içinde EquipementModel çağırıyor musunuz? –

+0

Hayır, değilim, EquipementModel'de Müdahalelerimi arayacağımModel –