EJB-3.1 #Startup & #Schedule anotation in Apache Tomee for Timer Execution - java-ee-6

I have following code to run on Apache-tomee, i am using eclipse for coding, and i want to run my simple schedule job using #Schedule annotation at application start-up.
#Startup
#Singleton
public class ScheduleEJB {
private static int count = 0;
#Schedule(second="*/10", minute="*", hour="*", info="MyTimer")
public void execute() {
System.out.println("its running count..."+count);
count++;
}
}
When i deployed this code on Tomee, it get me following message and unable to run my schedule method execute() automatically at startup, where as this code works fine in glassfish, but i am not going to use it either glassfish of jboss.
Dec 21, 2012 9:59:45 AM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Using default implementation for ThreadExecutor
Dec 21, 2012 9:59:45 AM org.quartz.core.SchedulerSignalerImpl
INFO: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
Dec 21, 2012 9:59:45 AM org.quartz.core.QuartzScheduler
INFO: Quartz Scheduler v.2.1.6 created.
Dec 21, 2012 9:59:45 AM org.quartz.simpl.RAMJobStore initialize
INFO: RAMJobStore initialized.
Dec 21, 2012 9:59:45 AM org.quartz.core.QuartzScheduler initialize
INFO: Scheduler meta-data: Quartz Scheduler (v2.1.6) 'OpenEJB-TimerService-Scheduler' with instanceId 'OpenEJB'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.apache.openejb.core.timer.DefaultTimerThreadPoolAdapter' - with 0 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
Dec 21, 2012 9:59:45 AM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler 'OpenEJB-TimerService-Scheduler' initialized from an externally provided properties instance.
Dec 21, 2012 9:59:45 AM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler version: 2.1.6
Dec 21, 2012 9:59:45 AM org.quartz.core.QuartzScheduler start
INFO: Scheduler OpenEJB-TimerService-Scheduler_$_OpenEJB started.
Dec 21, 2012 9:59:45 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Created Ejb(deployment-id=ScheduleEJB, ejb-name=ScheduleEJB, container=My Singleton Container)
Dec 21, 2012 9:59:45 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Started Ejb(deployment-id=ScheduleEJB, ejb-name=ScheduleEJB, container=My Singleton Container)

Did you already have a look to TomEE examples page?
There is a similar example which actually running.
http://openejb.apache.org/examples-trunk/schedule-methods/README.html
Maybe you could give it a try and check what is actually different with yours.

Your code runs fine on last release of TomEE. What was your version?

Related

jade web services integration gateway

I have gone through the following url for building webservices in jade http://jade.tilab.com/doc/tutorials/WSIG_Guide.pdf
Last page gives you instructions to run sample examples given by wsig....
When i tried running runMathAgent.bat ...I am getting the following output
Jul 15, 2016 12:57:55 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Jul 15, 2016 12:57:55 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Jul 15, 2016 12:57:55 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Jul 15, 2016 12:57:55 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Jul 15, 2016 12:57:55 PM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Jul 15, 2016 12:57:55 PM jade.core.AgentContainerImpl startBootstrapAgents
> SEVERE: Cannot create agent MathAgent1: Class
> com.tilab.wsig.examples.MathAgent for agent ( agent-identifier :name
> MathAgent1#WSIGTestPlatform ) not found - Caused by:
> com.tilab.wsig.examples.MathAgent
Jul 15, 2016 12:57:55 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Container-2#192.168.1.3 is ready.
--------------------------------------------
I finally figured solution for my problem. To run jade web services examples u need to deploy using ant (ant deploy-examples) and configuration includes juddi version of apache. This will solve the problem.
You need to run jade web services examples by deploying the exemples: using ant deploy-examples command.

Tomcat persistence manager using MongoDB as a Persistence store leads problems

I used Tomcat Persistence manager with MongoDB as a persistence store.I am getting lot of problems related to this.
Tomcat not going to shutdown properly. I need to kill it later.
It showing log like this.
Tomcat Log::: Jun 28, 2016 6:36:23 AM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port.Stopping the Server instance.
Jun 28, 2016 6:36:23 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-9082"]
Jun 28, 2016 6:36:23 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jun 28, 2016 6:36:23 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 28, 2016 6:36:23 AM com.mongodb.diagnostics.logging.JULLogger log
INFO: Closed connection [connectionId{localValue:24, serverValue:619}] to <host ip>:<port> because the underlying connection was closed.
After that no response.Then I manually killed that process.
MongoDB collection creating documents more than I expected(approxiamately 100 times). I took reference from these pages.
Tomcat Persistence manager
Mongo Store
Can Any One help regarding these issues?

Apache tomcat server startup increase over 30000 ms in eclipse Kepler

when i run my JSP page on apache tomcat 7 in my eclipse, server output shows up in 30000ms or more some times it never starts up, at first output got in lessthan 700ms,
Any help or suggession on this problem...
sample output...
NFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Mar 18, 2014 10:42:39 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [156] milliseconds.
Mar 18, 2014 10:42:58 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 18, 2014 10:42:58 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 18, 2014 10:42:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 30553 ms
Consider the following 2 suggestions:
1)As I commented above check if more then one application is running on the same server.This could be the primary reason.May be 3 or 4 applications might be running once you start your tomcat service.
2)May be some library that you are using for your application is creating some problem,for example the library might be initializing some file storage or may be something else.For this you will have to debug and check your stacktraces.

Deploying grails 2.0.3 application to cloudfoundry without cloud foundry grails-plugin?

I'm able to deploy my grails 2.0.3 app with the cloud foundry grails plugin and cf-push to the cloud and everything works fine.
Now i want to use the sts/eclipse cloud foundry extension to deploy with eclipse (not with grails command cf-push!) and see the server instances in server view and so on.
I create a new cloudfoundry instance with the eclipse plugin and it deploys but aborts with error message:
May 14, 2012 10:39:21 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-19036
May 14, 2012 10:39:21 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 377 ms
May 14, 2012 10:39:21 AM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
May 14, 2012 10:39:21 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 14, 2012 10:39:21 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
May 14, 2012 10:39:21 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Configuring Spring Security Core ...
... finished configuring Spring Security Core
May 14, 2012 10:39:32 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 14, 2012 10:39:32 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [net.sf.ehcache.CacheManager#1edb587] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [projectBee.Requestmap.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [projectBee.Role.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.UpdateTimestampsCache.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.StandardQueryCache.data] but has failed to stop it. This is very likely to create a memory leak.
Stopping Tomcat because the context stopped.
Is here somebody who knows a solution for this problem? Thank you!
You need to look at the real log files which will have the stacktrace and detailed error messages. Use the vmc commandline client or STS. There is a /logs folder which probably doesn't have what you want, but also a /tomcat/logs which probably does. Also check out stacktrace.log.

How do I run a web application using SpringSource Toolsuite?

I'd like to run my Spring application using STS, but I have no idea how to do that. I see the tc server instance, and I can run it, but this does not start my application. I've tried dragging my project workspace onto it, but that hasn't worked either. I've right-clicked and read/checked out all of the options on the context-sensitive menu, but I don't see anything to run my project inside tc server. Does anyone know how?
EDIT:
This is what I get when running the project. I see nothing about my project's war at all. It is included as a "web module" when I check out the tc server settings though. And it does have a web.xml and all of that other good stuff. The project works fine in maven's tomcat goal and inside IDEA. I am just having problems getting it to run in eclipse.
Mar 30, 2012 3:35:51 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tc Runtime property decoder using memory-based key
Mar 30, 2012 3:35:51 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tcServer Runtime property decoder has been initialized in 206 ms
Mar 30, 2012 3:35:52 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 30, 2012 3:35:52 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969 in 65 ms
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 741 ms
Mar 30, 2012 3:35:52 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 30, 2012 3:35:52 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.3.RELEASE/7.0.23.A.RELEASE
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\me\Documents\workspace-sts-2.9.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\trainingdividend.xml
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:trainingdividend' did not find a matching property.
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\Users\me\Documents\workspace-sts-2.9.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\insight.war
Mar 30, 2012 3:35:52 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
INFO: Context [localhost|insight] will not be woven
Mar 30, 2012 3:35:53 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Mar 30, 2012 3:36:03 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
Mar 30, 2012 3:36:05 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 30, 2012 3:36:05 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 13468 ms
If you are missing the Run As > Run on Server option, then chances are your project does not have the Dynamic Web Module facet.
I was running into 404 errors in my J2ee project, created using Dynamic WebModules. Initially I thought it was a context problem, as the url that STS was attempting to run was quite wrong. However the project the context was correct. But needed to get rid of the errors shown in the markers tab (which may not stop attempts to run as Server) before I made any progress.
After resolving obvious code, jar,path errors, I then check if I can export a war file correctly. If not, it is usually an issue in the DEPLOYMENT ASSEMBLY portion of the projects properties (at least in my Java project). Specifying the class files and jars from required projects is needed to get the correct war file structure. Once accomplished, bye bye 404s