I am sorry if my question seems too easy to know, but I am new to android and I do not know what i am doing wrong. I tried finding the solution to this on the net but could not come up with any solution. I also tried different methods. Please help me understand where I am going wrong. My app stops suddenly when I am trying an onClick event for listview(which I am printing in a textView)
here is my code,
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_main" tools:context=".SqlLiteActivity">
<ListView android:id="#id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:onClick="onClick"
/>
<TextView
android:id="#+id/mytextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
SqlLiteActivity.java
public class SqlLiteActivity extends Activity implements View.OnClickListener {
ListView myList = (ListView) findViewById(android.R.id.list);
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Printing a list
DatabaseHandler db = new DatabaseHandler(this);
List<Music> datadisplay = db.getAllMusic();
ArrayAdapter<Music> adapter = new ArrayAdapter<Music>(this, android.R.layout.simple_list_item_1, datadisplay);
myList.setAdapter(adapter);
}
public void onClick(View v)
{
TextView tv= (TextView) findViewById(R.id.mytextView);
String mystring = getResources().getString(R.string.mystring);
tv.setText(mystring);
}
Log:
10-29 18:23:58.196 15536-15536/? E/memtrack: Couldn't load memtrack module (No such file or directory)
10-29 18:23:58.196 15536-15536/? E/android.os.Debug: failed to load memtrack module: -2
10-29 18:23:58.581 3064-3519/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:23:59.336 3064-3259/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:23:59.336 3064-3259/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:23:59.346 3064-3259/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:00.516 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:00.521 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:00.526 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:01.446 3064-3404/? E/Watchdog: !#Sync 3600
10-29 18:24:05.661 3064-3572/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:05.666 3064-3559/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.151 3064-3491/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.256 3064-3556/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.331 3064-3490/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.441 3064-3467/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.551 3064-3572/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.706 3064-3490/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.856 3064-3607/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.951 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:06.961 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:07.636 3064-3538/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:07.786 3064-3543/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:08.031 3064-3607/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:08.206 3064-3607/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:08.451 3064-3543/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:08.641 3064-3538/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.021 3064-3573/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.191 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.191 3064-3543/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.321 3064-3491/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.401 15648-15648/? E/memtrack: Couldn't load memtrack module (No such file or directory)
10-29 18:24:09.401 15648-15648/? E/android.os.Debug: failed to load memtrack module: -2
10-29 18:24:09.486 3064-3607/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.696 3064-3466/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:09.891 3064-3259/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.061 3064-3490/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.061 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.351 3064-3556/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.546 3064-3466/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.546 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.546 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.551 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.836 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.836 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:10.841 3064-3328/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: FATAL EXCEPTION: main
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: Process: com.example.mayurpitale.bluetoothtrial2, PID: 15693
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.mayurpitale.bluetoothtrial2/com.example.mayurpitale.bluetoothtrial2.SqlLiteActivity}: java.lang.NullPointerException
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:161)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.os.Looper.loop(Looper.java:157)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5356)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: Caused by: java.lang.NullPointerException
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.Activity.findViewById(Activity.java:1965)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at com.example.mayurpitale.bluetoothtrial2.SqlLiteActivity.<init>(SqlLiteActivity.java:31)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.Class.newInstanceImpl(Native Method)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.Class.newInstance(Class.java:1208)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:161)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.os.Looper.loop(Looper.java:157)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5356)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
10-29 18:24:11.196 15693-15693/com.example.mayurpitale.bluetoothtrial2 E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-29 18:24:11.731 3064-15742/? E/android.os.Debug: !#Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
10-29 18:24:12.576 15634-15708/? E/Fabric: Unknown error while loading Crashlytics settings. Crashes will be cached until settings can be retrieved.
10-29 18:24:12.576 15634-15710/? E/Answers: Failed to retrieve settings
10-29 18:24:13.391 15877-15877/? E/SharedPreferenceProvider: onCreate
10-29 18:24:18.506 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.506 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.511 3064-3074/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.521 3064-3466/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.521 3064-3466/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.526 3064-3466/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.531 3064-3519/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.531 3064-3519/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.536 3064-3519/? E/EnterpriseContainerManager: ContainerPolicy Service is not yet ready!!!
10-29 18:24:18.736 15912-15912/? E/HealthDataStore: disconnectService : IllegalArgumentException
10-29 18:24:20.606 3064-3194/? E/WindowManager: Starting window AppWindowToken{46766310 token=Token{453b5820 ActivityRecord{43474858 u0 com.example.mayurpitale.bluetoothtrial2/.SqlLiteActivity t577}}} timed out
10-29 18:24:21.326 15947-15947/? E/HealthDataStore: disconnectService : IllegalArgumentException
10-29 18:24:21.446 21561-21561/? E/NetworkScheduler.SchedulerReceiver: Invalid parameter app
10-29 18:24:21.451 21561-21561/? E/NetworkScheduler.SchedulerReceiver: Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
10-29 18:24:21.616 16069-16081/? E/SPPClientService: ShipBuild Binary : True
10-29 18:24:23.061 15947-16058/? E/ActivityThread: Failed to find provider info for com.sec.android.service.health.cp.MigrationCpProvider
10-29 18:24:25.186 16259-16259/? E/ObjectHelper: Can't find method:setCompatibilityInfo
The list view has something like it's own onClickEvent. I know this is a bit late but if you're still in need perhaps this can help.
// As usual initialize your listview
ListView listview = findViewById(R.id.listviewname);
// The list view has it's own onclick event which goes by the item
// simply set an OnItemClick event. I hope this is answers your quesiton
// and in if it has, assuming you haven't already found the answer, have a
// great day.
listview.setOnItemClick(AdapterView<?>, final View view, final int position,
long l){
// Code goes here and when you want the system to know which button you
pressed you simply call the position perimeter.
});
Related
I am trying to incorporate SpringSession into my existing (non-Spring boot) application. I have followed Baeldung, which seems to make the most sense:
https://www.baeldung.com/spring-session
Here is my Maven dependencies:
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
Here is the configuration code that I have created:
#Configuration
#EnableRedisHttpSession
public class SessionConfig{
#Bean
public JedisConnectionFactory jedisConnectionFactory() {
JedisConnectionFactory jedisConnectionFactory = new
JedisConnectionFactory();
jedisConnectionFactory.setHostName("localhost");
jedisConnectionFactory.setPort(6379);
jedisConnectionFactory.setDatabase(1);
return jedisConnectionFactory;
}
#Bean
public RedisTemplate<String, Object> redisTemplate() {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(jedisConnectionFactory());
return template;
}
}
And here is the Initializer class that extends the HttpSessionInitializer:
public class Initializer extends AbstractHttpSessionApplicationInitializer {
public Initializer() {
super(SessionConfig.class);
}
}
My understanding is that this creates a bean that effectively intercepts sessions and uses Redis to manage them rather that using the Java In Memory session management.
However. I'm unable to deploy the application and am getting the following error in mt catalina logs:
07-Aug-2018 11:13:24.241 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:262)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4751)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:629)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1839)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
What I derive from this is that the classes that I am now including (possibly in the AbstractHttpSessionApplicationInitializer) are trying to load an application context which is conflicting with the ContextLoaderListener that is already declared in my web.xml. But if I remove that Listener from the web.xml, then that doesn't allow my app to deploy also.
I'm also getting this exception in my tomcat logs, but not sure if it's related:
07-Aug-2018 11:14:57.652 INFO [ektorp-idle-connection-monitor-thread-1] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [org.apache.http.pool.AbstractConnPool$4]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.http.pool.AbstractConnPool$4]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1311)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1299)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1158)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
at org.apache.http.pool.AbstractConnPool.closeExpired(AbstractConnPool.java:558)
at org.apache.http.impl.conn.PoolingClientConnectionManager.closeExpiredConnections(PoolingClientConnectionManager.java:302)
at org.ektorp.http.IdleConnectionMonitor$CleanupTask.run(IdleConnectionMonitor.java:52)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Is there anything that I am missing that could cause this error?
If you're using web.xml to bootstrap you web app, then you shouldn't be using AbstractHttpSessionApplicationInitializer but rather traditional XML configuration based approach.
You can take a look at Redis HttpSession with XML config guide that's available from Spring Session's reference documentation.
Your Spring config should contain the
When I run the project I see in my browser a page with "HTTP ERROR: 503 / Problem accessing /EmployeeTracker.html. Reason: SERVICE_UNAVAILABLE"
HTTP ERROR: 503
Problem accessing /EmployeeTracker.html. Reason:
Service Unavailable
Powered by Jetty://
Below is my web.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Servlets -->
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>EmployeeTracker.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>JsonStockData</servlet-name>
<servlet-class>com.teamcenter.awc.employee.server.JsonStockData</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name></servlet-name>
<url-pattern>/employeetracker/stockPrices</url-pattern>
</servlet-mapping>
</web-app>
Below is the stack trace:
[WARN] Server class 'org.eclipse.jetty.servlet.listener.ELContextCleaner' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/F:/workdir/eclipse-SDK-4.4.1-win32-x86_64/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/F:/workdir/eclipse-SDK-4.4.1-win32-x86_64/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/doc/helpInfo/webAppClassPath.html
Starting Jetty on port 0
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload{/,file:/D:/workdir/devunits/AWS/aw2.4.latest/eclipse/EmployeeTracker/war/},D:\workdir\devunits\AWS\aw2.4.latest\eclipse\EmployeeTracker\war
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:367)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1240)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:518)`enter code here`
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:717)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844)
at com.google.gwt.dev.DevMode.main(DevMode.java:322)
Caused by: java.lang.IllegalStateException: No such servlet:
at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1320)
at org.eclipse.jetty.servlet.ServletHandler.setServletMappings(ServletHandler.java:1414)
at org.eclipse.jetty.servlet.ServletHandler.addServletMapping(ServletHandler.java:896)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.addServletMapping(StandardDescriptorProcessor.java:1199)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitServletMapping(StandardDescriptorProcessor.java:632)
... 23 more
Have you got any clue how to solve it?
the servlet-name of your servlet-mapping is empty. try this :
<servlet-mapping>
<servlet-name>JsonStockData</servlet-name>
<url-pattern>/employeetracker/stockPrices</url-pattern>
</servlet-mapping>
I have two different web apps on my server. One is Spring mvc app and other is struts app. Libraries for these apps are at different locations. Following is my Spring mvc app structure:
All jar files for Spring mvc app are in WEB-INF/lib directory. Following is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>My project</display-name>
<servlet>
<servlet-name>route</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>route</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
When I run spring app, it shows exception:
[org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-6) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.myproject.scm.dao.LoginDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/route-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;
But when I run Spring mvc app without struts app, it runs fine. Maybe there are conflicting libraries?
Can I add classpath in my Spring mvc app, so that it look library jars at proper location?
JBoss 7 ships with Hibernate 3. You'll have to exclude it in your jboss-deployment-structure if you want to use Hibernate 4. Take a look at https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments for more information on implicit dependencies.
I'm developing a kind of complex hello world-spring webapp (since it has just the minimum functionality: one controller and one view (made with thymeleaf), simple database connection (oracle) and simple email sending capabilities).
Now I'm trying to deploy this webapp into tomcat-7 using my IDE (IntelliJ Idea 12.1.3 Ultimate) with not success at all while I'm obtaining from console:
Artifact infoSynth:war exploded: Artifact is being deployed, please wait...
org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/synthesizer] startup failed due to previous errors
org.apache.catalina.startup.HostConfig deployDirectory
And from Tomcat's log:
org.apache.catalina.core.StandardContext listenerStart
SEVERE: error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4823)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:762)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:762)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1454)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:74)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1295)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1387)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:818)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Before adding the email stuff (taken from here), the webapp just works fine, but when adding email related service and controller everything goes down and the org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart appears.
I'm using Spring 3.1.1, Thymeleaf 2.0.12, I'm NOT using maven and this is my web.xml:
<!-- Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Someone suggests something as basic as char enconding. Do you think that could be a valid reason? Can anyone put me in the right direction? Some further reading? Some advice? Thanks in advance!
The clue that helps me to solve my problem was here: Tomcat Severe listenerStart error
As I need to update my libraries some of these were missed from new artifacts and that was the underlying reason for the error.
SOLVED!
What happened in my case was that I spelled the name of my class wrong in the in web.xml
I was not able to figure out what was going on till I found the localhost.log and saw a classnotfound exception...
For some reason the actual error was not in the catalina.out it was under localhost.yyyy-mm-dd.log in the logs folder in your Tomcat directory
I had a number of XML files which had data (commented data) added before the XML definition (<?xml version="1.0"?>). Once I removed the commented strings and moved them to be after the XML definition, I started my web applications with no issues.
ASPNET WSRP Producer
Enviroment
Server Side
APSNETWSRPProducer (producer)
IIS
ASPNET Site
Producer Site
Client Side
Liferay 5.2.3 Tomcat 6
WSRP Proxy (consumer)
Description
I am trying to use Microsoft's ASPNET WSRP Producer.
I created a site and added a simple .aspx "Hello World!".
Created another site to host Producer.
Tried to get information from the consumer.
Liferay Log
21:24:22,379 ERROR [jsp:165] org.apache.wsrp4j.exception.WSRPException: No message found.
Nested Throwable is:
Server was unable to process request. ---> Object reference not set to an instance of an object.
at org.apache.wsrp4j.exception.WSRPXHelper.getException(WSRPXHelper.java:714)
at org.apache.wsrp4j.exception.WSRPXHelper.throwX(WSRPXHelper.java:133)
at org.apache.wsrp4j.exception.WSRPXHelper.handleWSRPFault(WSRPXHelper.java:660)
at org.apache.wsrp4j.consumer.driver.ProducerImpl.getServiceDescription(ProducerImpl.java:464)
at org.apache.wsrp4j.consumer.driver.ProducerImpl.getServiceDescription(ProducerImpl.java:391)
at org.apache.wsrp4j.consumer.driver.ProducerImpl.getPortletDescription(ProducerImpl.java:490)
at com.liferay.portlet.wsrp.WSRPProxyPortlet._getPortletDescription(WSRPProxyPortlet.java:681)
at com.liferay.portlet.wsrp.WSRPProxyPortlet._getWindowSession(WSRPProxyPortlet.java:458)
at com.liferay.portlet.wsrp.WSRPProxyPortlet._renderRemote(WSRPProxyPortlet.java:316)
at com.liferay.portlet.wsrp.WSRPProxyPortlet.render(WSRPProxyPortlet.java:133)
at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:126)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:69)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:632)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:700)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:419)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
Producer OutPutTrace.info
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/03/addressing/fault</wsa:Action>
<wsa:MessageID>uuid:1d118ef4-8020-4fb0-a0de-4fcfaaa7e239</wsa:MessageID>
<wsa:RelatesTo>uuid:a37a4393-badf-431e-8a22-ac010ba47596</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-179325ab-f6b6-4370-b883-eac6998e8cbe">
<wsu:Created>2009-10-26T16:46:25Z</wsu:Created>
<wsu:Expires>2009-10-26T16:51:25Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object. </faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
</log>