I use Grails with the JaxRS 311 plugin. I use it with Jersey.
My application is running on a tomcat 7.0.55 server. My server logs in production show the following info messages. I was wondering why "Couldn't find grammar element for class" is an INFO log. Here is the log:
INFO: Couldn't find grammar element for class test.shared.dto.NotificationDtoCollection
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UserDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDtoCollection
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UploadItemDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UploadItemDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDetailsDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDetailsDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class boolean
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
I found the following questions but they do not help in my case: Jersey: what does "couldn't find grammar element" mean? and A JSON object in a POST request for webserver with JERSEY
All my classes have a public default constructor and may be a second parameterized constructor:
class UserDto {
String id
String firstName
String lastName
public UserDto() { }
public UserDto(User user, User currentUser) {
...
}
}
What do these INFO log messages mean and how can I prevent them?
Those messages will go away if you setup the following parameter in your web.xml inside the definition of your <servlet>:
<init-param>
<param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
<param-value>true</param-value>
</init-param>
And restart your serlvet container to take effect.
Does it help if you use JAXB annotations for your classes? Perhaps you can use this as tutorial: http://www.vogella.com/tutorials/JAXB/article.html
Related
TLDR: Do I have to use different syntax to access my servlet if I am using Tomcat instead of Glassfish or jkd 1.7 instead of jdk 1.8? I can't get my jquery ajax to communicate with my servlet (in eclipse 1.7 jdk tomcat instead of netbeans 1.8 jdk glassfish)
I am trying to convert my project from Netbeans 1.8 JDK to Eclipse 1.7 JKD.
It worked fine in Netbeans. I have spent over 5 hours trying to get it to function on Eclipse now.
I think the problem is that it is not mapping my ajax "search" to the servlet "/search" .
The servlet is annotated
#WebServlet(name = "SearchServlet", urlPatterns = {"/search"})
I have to assume this works with JDK 1.7.....?
I had trouble adding a glassfish server the same as my netbeans. I managed to add it but then it vanished and I had no server available whatsoever until I gave up and put in a tomcat one. However I don't know if you're supposed to configure this any further.
I try to add glassfish server tools by dragging it into my IDE but it says Nothing to update: nothing to update. So I'm just sticking with tomcat.
Here is the log when I run my jsp:
Apr 20, 2015 1:48:48 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:animelist1' did not find a matching property.
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.21
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Mar 23 2015 14:11:21 UTC
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.21.0
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.7.0_79\jre
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\J\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Program Files\apache-tomcat-8.0.21
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\J\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\apache-tomcat-8.0.21
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\J\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\apache-tomcat-8.0.21\endorsed
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Apr 20, 2015 1:48:48 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_79\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Java\jdk1.7.0_79\jdk1.7.0_79\bin;.
Apr 20, 2015 1:48:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Apr 20, 2015 1:48:48 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Apr 20, 2015 1:48:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Apr 20, 2015 1:48:48 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Apr 20, 2015 1:48:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 772 ms
Apr 20, 2015 1:48:48 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 20, 2015 1:48:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.21
Apr 20, 2015 1:48:49 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Apr 20, 2015 1:48:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Apr 20, 2015 1:48:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Apr 20, 2015 1:48:49 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1162 ms
Here is the log when I try to make a search by clicking the button on the jsp:
Apr 20, 2015 1:50:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet SearchServlet as unavailable
Apr 20, 2015 1:50:11 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet SearchServlet
javax.naming.NameNotFoundException: Name [main.SearchServlet/annj] is not bound in this Context. Unable to find [main.SearchServlet].
at org.apache.naming.NamingContext.lookup(NamingContext.java:818)
at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
at org.apache.catalina.core.DefaultInstanceManager.lookupFieldResource(DefaultInstanceManager.java:573)
at org.apache.catalina.core.DefaultInstanceManager.processAnnotations(DefaultInstanceManager.java:461)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:144)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:121)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Further searches after the first give this:
POST http://localhost:8080/animelist1/search 404 (Not Found)jQuery.ajaxTransport.send # jquery-1.10.2.js:8706jQuery.extend.ajax # jquery-1.10.2.js:8136(anonymous function) # basic.js:8jQuery.event.dispatch # jquery-1.10.2.js:5095jQuery.event.add.elemData.handle # jquery-1.10.2.js:4766
I had to change my Environment variables to downgrade to JDK 1.7. I have put them below incase they are incorrect and are causing the issues (been messing around with them so much but I think they are right now):
(No added/changed User variables)
System variables:
Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Java\jdk1.7.0_79\jdk1.7.0_79\bin
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_79
I am about to give up and revert to Netbeans 1.8 JDK and upload my web project to somewhere other than Google App Engine (which only works with 1.7). I will give it another hour incase anyone is able to help me but I have spent far too long wasting my time when there is another option.
Like I said I suspect the problem is something to do with my server configuration or some file related to that. Below I will paste my ajax and my servlet. They do both work in netbeans 1.8 jdk but perhaps they need changing for eclipse 1.7 jdk?
Thankyou for reading!
Jquery
$(document).ready(function () {
$('#searchForm').submit(function () {
$.ajax({
url: 'search',
type: 'POST',
dataType: 'text',
data: $('#searchForm').serialize(),
success: function (data) {
$('#displaySearchResults').html(data);
// $('#displaySearchResults').slideDown(500);
//
$("#sortable1").empty();
$.each(JSON.parse(data), function (listID, mapData) {
$("#sortable1").append(
"<li class=userList><div class=selectedItemId id=" + mapData.id + "><img class=selectedItemImg src="
+ mapData.url + " alt=" + mapData.name
+ " style='width:216px;height:300px'></img><div id='animeTitle'>"
+ mapData.name+ "</div></div></li>");
// <ul id="sortable1" class="connectedSortable">
// <li class="ui-state-default">Item 1</li>
// var d1 = mapData.id;
// var d2 = d1.replace("'","");
// var div = document.createElement(d2);
// document.body.appendChild(div);
// $("#"+divName).text(mapData.id);
// $("#displaySearchResults2").text(mapData.name);
// $("#displaySearchResults3").text(mapData.url);
});
}
});
return false;
});
});
Servlet
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package main;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.gson.Gson;
import entities.Anime;
import entities.Ann;
import entities.Info;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* #author J
*/
#WebServlet(name = "SearchServlet", urlPatterns = {"/search"})
public class SearchServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
#EJB
private AnnJAXB annj;
// #EJB
// private AnnJAXB annJAXB = new AnnJAXB();
#EJB
private Ann ann;
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* #param request servlet request
* #param response servlet response
* #throws ServletException if a servlet-specific error occurs
* #throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SearchServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SearchServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* #param request servlet request
* #param response servlet response
* #throws ServletException if a servlet-specific error occurs
* #throws IOException if an I/O error occurs
*/
#Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* #param request servlet request
* #param response servlet response
* #throws ServletException if a servlet-specific error occurs
* #throws IOException if an I/O error occurs
*/
#Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// processRequest(request, response);
// Map <String, Object> map = new HashMap<String, Object>();
String searchQuery = request.getParameter("searchQuery");
// response.getWriter().write(searchQuery);
// map.put("searchQuery", searchQuery);
// returnResults(response, map);
returnResults(response, searchQuery);
}
private void returnResults(HttpServletResponse response, String searchQuery) throws IOException {
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
ArrayList<Map> arrayOfMap = new ArrayList<Map>();
try {
for (Anime anime : annj.Unmarshalling(searchQuery).getAnn()) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", anime.getName());
map.put("id", anime.getId());
for (Info temp : anime.getAnime()) {
if (temp.getSrc() != null) {
map.put("url", temp.getSrc());
}
}
arrayOfMap.add(map);
}
response.getWriter().write(new Gson().toJson(arrayOfMap));
} catch (Exception e) {}
}
/**
* Returns a short description of the servlet.
*
* #return a String containing servlet description
*/
#Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
TLDR: Do I have to use different syntax to access my servlet if I am using Tomcat instead of Glassfish or jkd 1.7 instead of jdk 1.8? I can't get my jquery ajax to communicate with my servlet (in eclipse 1.7 jdk tomcat instead of netbeans 1.8 jdk glassfish)
As I know , the notation
#WebServlet(name = "SearchServlet", urlPatterns = {"/search"})
only work in jdk 1.8
but if you still use jdk 1.7, forget the notation and fill web.xml with this map
<servlet>
<servlet-name>search</servlet-name>
<servlet-class>yourPackage.search</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>search</servlet-name>
<url-pattern>/search</url-pattern>
</servlet-mapping>
I am developing a java application that executes ssh commands using Ganymed SSH-2
I need to produce full logs for each sequence of commands, e.g. zip file transfer, unzipping, zipping etc..
Having searched the source code for ch.ethz.ssh2.log.Logger i can set the boolean public static volatile boolean enabled = false; to true
this provides the following output
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: kex_algo=diffie-hellman-group-exchange-sha1
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: server_host_key_algo=ssh-rsa
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: enc_algo_client_to_server=aes128-ctr
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: enc_algo_server_to_client=aes128-ctr
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: mac_algo_client_to_server=hmac-sha1-96
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: mac_algo_server_to_client=hmac-sha1-96
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: comp_algo_client_to_server=none
Mar 05, 2015 10:17:25 AM ch.ethz.ssh2.log.Logger info
INFO: comp_algo_server_to_client=none
However I also require ALL level logging for command execution including file transfers.
How do i configure the Logger to produce all the information available?
A little late answer but maybe someone still needs this info.
I managed to get the debug statements visible like this:
public void enableFineLogging() {
try {
ch.ethz.ssh2.log.Logger.enabled = true;
String name = "myDynamicFileNamePart";
FileHandler fileHandler = new FileHandler("./logs/"
+ name + "_SFTP.log", 10000000, 1000, true);
fileHandler.setLevel(Level.FINE);
fileHandler.setFormatter(new SimpleFormatter());
final Logger app = Logger.getLogger("ch.ethz");
app.setLevel(Level.FINE);
app.addHandler(fileHandler);
app.setUseParentHandlers(false);
} catch (Exception e) {
// Catchalog
}
}
With result in file with:
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter info
INFO: Client identity string: SSH-2.0-SSHJ_0.19.1
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter info
INFO: Server identity string: SSH-2.0-OpenSSH_6.6.1
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter debug
FINE: Setting <> to null
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter debug
FINE: Sending SSH_MSG_KEXINIT
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter debug
FINE: Setting <> to SOME
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter debug
FINE: Awaiting <>
marras 15, 2017 12:16:56 IP. org.slf4j.impl.JCLLoggerAdapter debug
FINE: Received SSH_MSG_KEXINIT
Use ConsoleHandler if you wish logs in console.
Also closing the log file needs to be considered with fileHandler.close() after you quit logging.
Tune the log level by choosing from SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
I am getting this error:
Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: contextInitialized()
Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: SessionListener: contextInitialized()
Feb 11, 2014 10:32:34 AM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#6b2c636d')
Feb 11, 2014 10:43:04 AM org.apache.catalina.core.ApplicationContext log
Information: No Spring WebApplicationInitializer types detected on classpath
Feb 11, 2014 10:43:05 AM org.apache.catalina.core.ApplicationContext log
Information: Initializing Spring root WebApplicationContext
Feb 11, 2014 10:43:06 AM org.apache.catalina.core.StandardContext listenerStart
Schwerwiegend: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: elektrova/UserController, method: $tt__index signature: (Ljava/lang/Integer;Lorg/springframework/transaction/TransactionStatus;)Ljava/lang/Object;) Stack size too large
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.VerifyError: (class: elektrova/UserController, method: $tt__index signature: (Ljava/lang/Integer;Lorg/springframework/transaction/TransactionStatus;)Ljava/lang/Object;) Stack size too large
at java.lang.Class.forName(Class.java:270)
... 5 more
In this method:
def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
if(!session.isAdmin){
Hauler haul = Hauler.get(session.haulerID)
println haul
if(params.firstName)
respond User.findAllWhere([hauler:haul,firstName:params.firstName]), model:[userInstanceCount: User.count()]
else if(params.lastName)
respond User.findAllWhere([hauler:haul,lastName:params.lastName]), model:[userInstanceCount: User.count()]
else if(params.role)
respond User.findAllWhere([hauler:haul,role:params.role]), model:[userInstanceCount: User.count()]
else
respond User.findAllByHauler(haul), model:[userInstanceCount: User.count()]
}else{
if(params.firstName){
model:[userInstanceList: User.findAllByFirstName(params.firstName),userInstanceCount: User.count()]
}else if(params.lastName)
model:[userInstanceList: User.findAllByLastName(params.lastName),userInstanceCount: User.count()]
else if(params.role)
model:[userInstanceList: User.findAllByRole(params.role),userInstanceCount: User.count()]
else
model:[userInstanceList: User.list(params),userInstanceCount: User.count()]
}
}
I found this thread, that solves the problem imho:
VerifyError: Stack size too large (what does it mean?)
but I don't quite get how to calculate and declare the stack size. And I don't understand either, why I have to declare it, since other methods don't need it.
Thanks for any help!
The problem disappeared without me changing anything, I have no idea why
I am working on Mahout and found an issue when I tried to change my csv, previously it was giving me proper recommendations.
Example code:
model = new FileDataModel(new File("E:\\WriteTest.csv"));
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(2,similarity,model);
Recommender recomender = new GenericUserBasedRecommender(model,neighborhood, similarity);
List<RecommendedItem> recommendations = recomender.recommend(1,1);
for(RecommendedItem recommendation: recommendations){
System.out.println(recommendation);
}
I have just updated the values of my csv and it has stopped giving me suggestion.
CSV that is not giving me any result:
1,13,9.9
1,26,9.0
1,40,4.0
2,83,9.9
2,167,9.0
2,250,4.0
3,91,9.9
3,167,9.0
3,274,4.0
4,91,9.9
4,167,2.0
CSV which is giving me result:
1,101,5.0
1,102,3.0
1,103,3.0
2,101,5.0
2,102,2.5
2,103,3.0
2,104,2.1
3,101,5.0
3,102,2.5
3,105,4.0
3,107,5.0
4,102,2.0
4,104,4.0
4,105,2.5
4,106,3.0
4,107,2.6
5,101,5.0
5,102,3.4
5,104,2.5
5,105,2.5
5,106,1.0
Output on console respectively:
Result from 1st Dataset Aug 27, 2011 2:45:06 AM
org.slf4j.impl.JCLLoggerAdapter info INFO: Creating FileDataModel for
file WriteTest.csv Aug 27, 2011 2:45:06 AM
org.slf4j.impl.JCLLoggerAdapter info INFO: Reading file info... Aug
27, 2011 2:45:06 AM org.slf4j.impl.JCLLoggerAdapter info INFO:
Readlines: 11 Aug 27, 2011 2:45:06 AM org.slf4j.impl.JCLLoggerAdapter
info INFO: Processed 4 users
I was expecting Item no 167 but din't find any recommendation
Output of 2nd dataset:
Aug 27, 2011 2:52:42 AM org.slf4j.impl.JCLLoggerAdapter info
INFO: Creating FileDataModel for file WriteTest.csv
Aug 27, 2011 2:52:42 AM org.slf4j.impl.JCLLoggerAdapter info
INFO: Reading file info...
Aug 27, 2011 2:52:42 AM org.slf4j.impl.JCLLoggerAdapter info
INFO: Read lines: 21
Aug 27, 2011 2:52:42 AM org.slf4j.impl.JCLLoggerAdapter info
INFO: Processed 5 users
RecommendedItem[item:105, value:3.25]
The recommender is working correctly. The problem is that your data is too sparse. It cannot find a similarity that would link two users such that 167 is recommendable. Try a more realistic data set and I think the behavior will look less surprising.
I have two virtual machines in a private
cloud, and I want to execute Jade both of them. They can access each
other without problems. I started in one of them the Main Container, and
in the other a Container which would connect to the main. However, I get
a Dispatcher exception when this connection tries to take place:
--------
INFO: Adding node <Container-1> to the platform
Jun 22, 2011 12:54:34 PM jade.core.messaging.MessagingService
clearCachedSlice
INFO: Clearing cache
Jun 22, 2011 12:54:34 PM jade.core.messaging.MessagingService
$CommandTargetSink handleNewSlice
WARNING: Error notifying current information to new Messaging-Slice
Container-1
jade.core.IMTPException: Dispatcher error [nested
jade.imtp.leap.DispatcherException: DispatcherException in remote site.
No skeleton for object-id 3447152]
at jade.imtp.leap.NodeStub.accept(NodeStub.java:91)
at jade.core.messaging.MessagingProxy.addRoute(MessagingProxy.java:257)
at jade.core.messaging.MessagingService
$CommandTargetSink.handleNewSlice(MessagingService.java:993)
at jade.core.messaging.MessagingService
$CommandTargetSink.consume(MessagingService.java:906)
at jade.core.CommandProcessor
$SinksFilter.accept(CommandProcessor.java:253)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at
jade.core.CommandProcessor.processIncoming(CommandProcessor.java:229)
at
jade.core.PlatformManagerImpl.issueNewSliceCommand(PlatformManagerImpl.java:744)
at
jade.core.PlatformManagerImpl.localAddSlice(PlatformManagerImpl.java:445)
at
jade.core.PlatformManagerImpl.localAddNode(PlatformManagerImpl.java:293)
at jade.core.PlatformManagerImpl.addNode(PlatformManagerImpl.java:245)
at
jade.imtp.leap.PlatformManagerSkel.executeCommand(PlatformManagerSkel.java:73)
at jade.imtp.leap.Skeleton.processCommand(Skeleton.java:51)
at
jade.imtp.leap.CommandDispatcher.handleCommand(CommandDispatcher.java:949)
at jade.imtp.leap.JICP.JICPServer
$ConnectionHandler.run(JICPServer.java:439)
Nested Exception:
jade.imtp.leap.DispatcherException: DispatcherException in remote site.
No skeleton for object-id 3447152
at
jade.imtp.leap.CommandDispatcher.checkRemoteExceptions(CommandDispatcher.java:516)
at
jade.imtp.leap.CommandDispatcher.dispatchSerializedCommand(CommandDispatcher.java:418)
at
jade.imtp.leap.CommandDispatcher.dispatchCommand(CommandDispatcher.java:343)
at jade.imtp.leap.NodeStub.accept(NodeStub.java:83)
at jade.core.messaging.MessagingProxy.addRoute(MessagingProxy.java:257)
at jade.core.messaging.MessagingService
$CommandTargetSink.handleNewSlice(MessagingService.java:993)
at jade.core.messaging.MessagingService
$CommandTargetSink.consume(MessagingService.java:906)
at jade.core.CommandProcessor
$SinksFilter.accept(CommandProcessor.java:253)
at jade.core.Filter.filter(Filter.java:89)
at jade.core.Filter.filter(Filter.java:90)
at jade.core.Filter.filter(Filter.java:90)
at
jade.core.CommandProcessor.processIncoming(CommandProcessor.java:229)
at
jade.core.PlatformManagerImpl.issueNewSliceCommand(PlatformManagerImpl.java:744)
at
jade.core.PlatformManagerImpl.localAddSlice(PlatformManagerImpl.java:445)
at
jade.core.PlatformManagerImpl.localAddNode(PlatformManagerImpl.java:293)
at jade.core.PlatformManagerImpl.addNode(PlatformManagerImpl.java:245)
at
jade.imtp.leap.PlatformManagerSkel.executeCommand(PlatformManagerSkel.java:73)
at jade.imtp.leap.Skeleton.processCommand(Skeleton.java:51)
at
jade.imtp.leap.CommandDispatcher.handleCommand(CommandDispatcher.java:949)
at jade.imtp.leap.JICP.JICPServer
$ConnectionHandler.run(JICPServer.java:439)
Jun 22, 2011 12:54:34 PM jade.core.PlatformManagerImpl$1 nodeAdded
INFO: --- Node <Container-1> ALIVE ---
Jun 22, 2011 12:54:34 PM
jade.core.nodeMonitoring.BlockingNodeFailureMonitor run
INFO: PING from node Container-1 exited with exception. Dispatcher error
[nested jade.imtp.leap.DispatcherException: DispatcherException in
remote site. No skeleton for object-id 3447152]
Jun 22, 2011 12:54:34 PM jade.core.PlatformManagerImpl$1 nodeUnreachable
WARNING: --- Node <Container-1> UNREACHABLE ---
Jun 22, 2011 12:54:34 PM jade.core.PlatformManagerImpl
removeTerminatedNode
INFO: --- Node <Container-1> TERMINATED ---
Jun 22, 2011 12:54:34 PM jade.core.messaging.MessagingService
clearCachedSlice
---------
In the other node I get the following:
--------
Jun 22, 2011 12:55:35 PM jade.core.AgentContainerImpl joinPlatform
SEVERE: Some problem occurred while joining agent platform.
jade.core.ServiceException: An error occurred during service booting
[nested java.lang.NullPointerException]
at
jade.core.AgentContainerImpl.bootAllServices(AgentContainerImpl.java:465)
at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:408)
at
jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:485)
at jade.core.Runtime.createAgentContainer(Runtime.java:133)
at BookBuyTest2.main(BookBuyTest2.java:25)
Exception in thread "main" java.lang.NullPointerException
at BookBuyTest2.main(BookBuyTest2.java:35)
------
Any ideas about what I am doing wrong?
Thank you very much in advance,
The problem was that in the node I put:
local-host:127.0.0.1
This was solved by putting
local-host: <actual IP of the machine\>
To me, this worked
String[] container = {
"-gui",
"-local-host 127.0.0.1",
"-container",
"Agent1:jogo.agents.Agent1;Agent2:jogo.agents.Agent2" // <- Your custom agents
};
Boot.main(container);