jboss varia scheduler not working in jboss AS 7 - jboss

I have a web app (.war) to be deployed to JBoss EAP 6.2.0, and there's a class in the app that implements org.jboss.varia.scheduler.Schedulable. I have put the jar file scheduler-plugin.jar in my WEB-INF\lib directory. I have defined a "scheduler-service.xml"(as shown below) to schedule some task on a daily frequency.
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.varia.scheduler.Scheduler"
name=":service=MyScheduler">
<attribute name="StartAtStartup">false</attribute>
<attribute name="SchedulableClass">com.myApp.MyClass</attribute>
<attribute name="DateFormat">dd/MM/yy HH:mm</attribute>
<attribute name="InitialStartDate">01/01/1970 00:00</attribute>
<attribute name="SchedulePeriod">86400000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="FixedRate">true</attribute>
</mbean>
</server>
This setup was working all fine on Jboss EAP 5.0.1 but these schedulers do not get triggered in Jboss EAP 6.2.0 on deployment. Any help would be highly appreciated.

These are no longer supported. Use the standard EJB #Schedule annotation instead.

Related

Why are Eclipse project files modified when excuting the "Update Maven Project" command?

I installed Eclipse 2019-06 on a new workstation and imported our team's maven project. When running the "Update Maven Project" command, for all subprojects, some of the project files are edited, whereas they are not on my current workstation (with one exception). My station runs Eclipse Oxygen 4.7.0.
Is there a way to determine why these modifications occur on this station and not on others?
Is there a way to turn off these modifications so that our projects are unified?
The modifications are the following :
In the ".classpath" file, the lines with *** at the beggining are added
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>***
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test->classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>***
</attributes>
</classpathentry>
In the ".project" file, the "RiderProjectBuilder" buildcommand is added as well as the "RiderProjectBuilder" natures
<buildCommand>
<name>org.fusesource.ide.project.RiderProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.fusesource.ide.project.RiderProjectNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
In the ".settings/org.eclipse.jdt.core.prefs" file, all the following lines are added
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
The exception I mentionned earlier concerns the line "org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning" which is also added on my workstation. It seems to be replicating an exception I configured for one subproject to all other subprojects, and it is also annoying.
Eclipse 2019-06 (4.12) releases notes on Workspace compatibility
Downward workspace compatibility is not supported. A workspace created (or opened) by a product based on Eclipse 4.12 will be unusable with a product based on an earlier version of Eclipse.
While individual projects could still be usable across different versions the paragraph above states that backward compatibility is not supported, meaning issues like the one you describe are expected to happen.
To turn off any unwanted modification as much as possible it's suggested to exclude IDE specific project files from git repositories.
Another option could be to normalize the IDE version across teams, i.e. make all team members use the same version.

WildFly deployment only works in standalone-mode but not in Eclipse

I'm trying to learn JavaEE 7 in detail and I have problems to get records from the database and display them on a JSF page.
I use WildFly 10.1.0 and Oracle XE11. I've created the following data source:
<datasource jndi-name="java:/supportApp" pool-name="OracleDS" enabled="true">
<connection-url>jdbc:oracle:thin:#localhost:1521:xe</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
</datasource>
The connection test in JBoss' admin interface is successful.
This is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="SupportApp" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/supportApp</jta-data-source>
<shared-cache-mode>NONE</shared-cache-mode>
<class>org.model.User</class>
</persistence-unit>
</persistence>
When I run WildFly via the standalone.bat and deploy my application via mvn clean package wildfly:deploy it works.
When I start the server in Eclipse and try to deploy my application with the same command it fails - since I added the JPA part. The error message I get is this:
14:48:40,768 INFO [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for SupportApp
14:48:40,782 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 8) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.supportApp"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.persistenceunit.\"SupportAppEJB-0.0.1-SNAPSHOT.jar#SupportApp\" is missing [jboss.naming.context.java.supportApp]",
"jboss.persistenceunit.\"SupportAppEJB-0.0.1-SNAPSHOT.jar#SupportApp\".__FIRST_PHASE__ is missing [jboss.naming.context.java.supportApp]"
]
}
It seems to be a problem with the persistence unit, but I don't uderstand what the problem is and how I can solve it. Any suggestions?
It figuered out that when eclipse asked me about the server runtime it installed a second wildfly application server. therefore my changes in the standalone.xml of the manually installed one didn't take account in the server eclipse started. After changing the server runtime to the path where I manually installed wildfly and configured the datasource it works like a charm.

WebSphere migration appears in eclipse always

I use WebSphere Application Server 8.5 with Eclipse Mars 4.5.2. My problem is when I open Eclipse a migration for my server runtime appears always.
Both entries are the same?
I also have the whole project in git so I could check what has changed after migration. The interesting thing is that only the date, which is the first line from the com.ibm.ws.ast.st.migration.prefs file, has changed.
Has someone a hint how I could stop this "unnecessary" cycling migration.
For solving the problem we changed two settings:
1) in the .classpath we replaced the following classpathentry:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/WebSphere Application Server v8.5 JRE">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
with:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
2) in the org.eclipse.wst.common.project.facet.core.xml file we removed the following line:
<runtime name="WebSphere Application Server v8.5"/>

How do you specify external configuration in JBoss AS 7?

We're in the process of upgrading from JBoss Application Server 5.1 to AS 7. In AS 5.1 we defined a Properties object in a '-service.xml' file so that we could externalize all of our configuration. We then read this properties object in via JNDI.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<mbean code="org.jboss.naming.JNDIBindingServiceMgr" name="jboss.apps:name=myProperties">
<attribute name="BindingsConfig" serialDataType="jbxb">
<jndi:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
xs:schemaLocation="urn:jboss:jndi-binding-service resource:jndi-binding-service_1_0.xsd">
<jndi:binding name="myConfig">
<java:properties xmlns:java="urn:jboss:java-properties"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="urn:jboss:java-properties resource:java-properties_1_0.xsd">
<java:property>
...
What's the appropriate way to do this in AS 7?
It is explained here: https://community.jboss.org/message/641742#641742
Seems it is possible from AS 7.1, not in 7.0. Didn't try it yet, though.

JBoss (liferay) no context.xml so where to put JNDI resource

I've got the order to switch from Liferay on tomcat, to Liferay on JBoss.
One issue I'm having is that unlike in tomcat, I can't seem to find a context.xml in liferay-portal-6.0.5\jboss-5.1.0\server\default\conf
Will it work if I just copy the context.xml from my tomcat installation to my jboss installation? (I don't know if JBoss scans that folder).
Or is there an alternative location where I can put my resource?
<Resource name="jdbc/x" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="y"
username="z" password="A" maxActive="20" maxIdle="10"
maxWait="-1"/>
Add a file named "*- ds.xml" in the deploy directory server with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/myds</jndi-name>
<connection-url>jdbc:oracle:thin:#127.0.0.1:1521:sid</connection-url>
<user-name></user-name>
<password></password>
<new-connection-sql>SELECT * FROM DUAL</new-connection-sql>
<check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</local-tx-datasource>
</datasources>