[JBoss Tools] - JBoss Tools Litmus test(s) for project examples/archetypes
by Max Rydahl Andersen
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] modified the document:
"JBoss Tools Litmus test(s) for project examples/archetypes"
To view the document, visit: https://community.jboss.org/docs/DOC-17655
--------------------------------------------------------------
You have created you awesome project example or archetype which creates such example - now how do you know if it works well and especially works well with JBoss Tools ?
h2. Import + Run
The basic litmus test for an example that is a web/ear applicaiton is the following steps:
1) The project can be imported directly and without any errors and no serious warnings with either *File > Import > Existing Projects into Workspace* or *File > Import > Existing Maven Projects **
2) The project can be "Runned" on an Installed JBoss server in JBoss Tools by right clicking the project and choose *Run As > Run On Server* which should cause the server to get started, the project to be deployed and then be shown in a web browser (either internally inside Eclipse or externally dependent on your configuration)
*Note:* For #1 if your project example/archetype is available from JBoss Central view then this is the basic operation JBoss Central does so using steps in #1 or from JBoss Central are equally good to test if the example works.
If the project deploys and run after the two steps above there is a good chance you've at enabled users to easily try out the example, but there can be a few other good tests/validations to do to make sure the project is using things like Maven and JBoss Tools to the fullest and without encouraging bad practices.
Here are a few of the ones we have noticed while trying out examples from various teams:
h3. Unnecessary/wrong Jar's being packaged / Missing proper dependency scope
It's a common occurrence that when you use Maven you have a tendency to just add dependencies to the project until things start to work - unfortunately that can have the sideeffect of adding unnecessary jar's into the War or Ear which makes the deployment unnecessary heavy and might cause hard to understand/fix runtime issues.
Adding the following to a pom.xml:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
will have such potential side effect.
It will make the project compile if it uses CDI api's but it will also bundle the CDI jars into the project. For JBoss AS 7.x this probably will be fine at runtime since JBoss AS 7.x will choose its CDI classes over the bundled API's but it for sure makes your deployment too big and filled with jars that has no purpose.
The proper solution is to remember to set the proper dependency scope, like this:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
Now the project will compile but will assume the jar's are provided in the runtime and thus not bundle the jars.
Thus to fix this look at the actual generated war deployment from mvn command line AND JBoss Tools (since there might be subtle differences) and check if all the files (especially the jars) in the deployment actually deserves to be present.
Note: this test is for some a great eyeopener how it affects users of runtimes if the runtimes pom.xml is way too greedy about adding dependencies that is not warranted.
h2. Not utilizing the IDE where it should or could
The whole point of using pom.xml is so that tools (like Maven, Eclipse, IntelliJ, netbeans etc.) has a common set of metadata to read and from that do what it does best: provide tools for editing, navigating, building, deploying etc.
Most runtime devs know what Maven does since they use it to build the runtime, but fewer actually realizes what an IDE does since many rutime devs does not actually try and use their runtime as a user, not realizing which features the IDE provides or could provide.
An example is that JBoss Tools server adapter actually provides incrementally deployment of files, meaning there is no time spent on packaging/deployment - it just happens when you save the individual files.
More to come...
*
*
*
*
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-17655]
Create a new document in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
12 years, 7 months
[JBoss Tools] - JBoss Tools Litmus test(s) for project examples/archetypes
by Max Rydahl Andersen
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] modified the document:
"JBoss Tools Litmus test(s) for project examples/archetypes"
To view the document, visit: https://community.jboss.org/docs/DOC-17655
--------------------------------------------------------------
You have created you awesome project example or archetype which creates such example - now how do you know if it works well and especially works well with JBoss Tools ?
The basic litmus test for this is the following steps:
1) The project can be imported directly and without any errors and no serious warnings with either *File > Import > Existing Projects into Workspace* or *File > Import > Existing Maven Projects **
2) The project can be "Runned" on an Installed JBoss server in JBoss Tools by right clicking the project and choose *Run As > Run On Server* which should cause the server to get started, the project to be deployed and then be shown in a web browser (either internally inside Eclipse or externally dependent on your configuration)
*Note:* For #1 if your project example/archetype is available from JBoss Central view then this is the basic operation JBoss Central does so using steps in #1 or from JBoss Central are equally good to test if the example works.
If the project deploys and run after the two steps above there is a good chance you've at enabled users to easily try out the example, but there can be a few other good tests/validations to do to make sure the project is using things like Maven and JBoss Tools to the fullest and without encouraging bad practices.
Here are a few of the ones we have noticed while trying out examples from various teams:
h3. Unnecessary/wrong Jar's being packaged / Missing proper dependency scope
It's a common occurrence that when you use Maven you have a tendency to just add dependencies to the project until things start to work - unfortunately that can have the sideeffect of adding unnecessary jar's into the War or Ear which makes the deployment unnecessary heavy and might cause hard to understand/fix runtime issues.
Adding the following to a pom.xml:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
will have such potential side effect.
It will make the project compile if it uses CDI api's but it will also bundle the CDI jars into the project. For JBoss AS 7.x this probably will be fine at runtime since JBoss AS 7.x will choose its CDI classes over the bundled API's but it for sure makes your deployment too big and filled with jars that has no purpose.
The proper solution is to remember to set the proper dependency scope, like this:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
Now the project will compile but will assume the jar's are provided in the runtime and thus not bundle the jars.
*
*
*
*
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-17655]
Create a new document in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
12 years, 7 months
[jBPM] - Unknown resource type: null when call kagent.applyChangeSet( resource ) the second time.
by TC ONG
TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion
"Unknown resource type: null when call kagent.applyChangeSet( resource ) the second time."
To view the discussion, visit: https://community.jboss.org/message/722709#722709
--------------------------------------------------------------
URL url = new URL(CHANGE_SET_URL);
UrlResource resource = (UrlResource) ResourceFactory.newUrlResource( url );
KnowledgeAgentConfiguration agentConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
agentConfig.setProperty("drools.agent.newInstance", "true");
agentConfig.setProperty("drools.agent.scanDirectories", "false");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyKnowledgeAgent", agentConfig );
KnowledgeAgentEventListener kaListener = new KnowledgeAgentEventListener() {
@Override
public void resourceCompilationFailed(ResourceCompilationFailedEvent arg0) {
logger.debug("resourceCompilationFailed");
}
@Override
public void knowledgeBaseUpdated(KnowledgeBaseUpdatedEvent arg0) {
logger.debug("knowledgeBaseUpdated");
}
@Override
public void beforeResourceProcessed(BeforeResourceProcessedEvent arg0) {
logger.debug("beforeResourceProcessed");
}
@Override
public void beforeChangeSetProcessed(BeforeChangeSetProcessedEvent arg0) {
logger.debug("beforeChangeSetProcessed");
}
@Override
public void beforeChangeSetApplied(BeforeChangeSetAppliedEvent arg0) {
logger.debug("beforeChangeSetApplied");
}
@Override
public void afterResourceProcessed(AfterResourceProcessedEvent arg0) {
logger.debug("afterResourceProcessed");
}
@Override
public void afterChangeSetProcessed(AfterChangeSetProcessedEvent arg0) {
logger.debug("afterChangeSetProcessed");
}
@Override
public void afterChangeSetApplied(AfterChangeSetAppliedEvent arg0) {
logger.debug("afterChangeSetApplied");
}
};
kagent.addEventListener(kaListener);
kagent.applyChangeSet( resource );
kagent.monitorResourceChangeEvents(true);
The code above is ok but when I call
kagent.applyChangeSet( resource );
again then I get
Exception in thread "Thread-3" java.lang.RuntimeException: Unknown resource type: null
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:686)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:712)
at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1002)
at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:785)
at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:657)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169)
at com.geneoz.procedureengine.KnowledgeAgentTest$ResourcePoller.run(KnowledgeAgentTest.java:68)
at java.lang.Thread.run(Thread.java:680)
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/722709#722709]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[Datasource Configuration] - Configure Oracle datasource
by Mike Nebel
Mike Nebel [https://community.jboss.org/people/kneebull] created the discussion
"Configure Oracle datasource"
To view the discussion, visit: https://community.jboss.org/message/722941#722941
--------------------------------------------------------------
Hello,
I am new to jboss and am trying to get my system running properly. I am running JBoss 5.10 on RHEL5 in a cluster and have an Oracle 11i RAC database. I have searched and not seen this issue in any discussions.
I have successfully set up oracle-ds.xml and it is connecting properly. My question is that I want to replace Hypersonic with a different Oracle DB that has been created for this purpose. In my oracle-ds.xml, I have created a second datasource to replace the Hypersonic with Oracle. So I have:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/datasource1</jndi-name> <!-- This is the big Oracle DB -->
.... { first Oracle user/pw }
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name> <!-- This is the minimal Oracle DB to replace Hypersonic -->
..... { second Oracle user/pw }
</local-tx-datasource>
</datasources>
I have removed hsqldb-ds.xml and added /messaging/oracle-persistence-service.xml.
I do not see any errors in the logs.
Is this the correct approach? Anything I missed? Should I see entries in this new Oracle table I have to replace Hypersonic? How do I know it is working.
Thanks,
Mike
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/722941#722941]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months
[JBoss AOP] - POJO Cache failing on weblogic 11g managed servers
by paramita banerjee
paramita banerjee [https://community.jboss.org/people/pb2012] created the discussion
"POJO Cache failing on weblogic 11g managed servers"
To view the discussion, visit: https://community.jboss.org/message/722945#722945
--------------------------------------------------------------
Hi
I have set up Pojo cache to work with weblogic server 11g.
I have annotated and instrumented the classes as mentioned in user guide.
The Pojo cache attach/find works well when I deploy the application on weblogic admin server.
But when I deploy the application on any managed servers in the same weblogic domain, I get the following exception:
java.lang.NullPointerException
at org.jboss.aop.Domain$1.run(Domain.java:124)
at org.jboss.aop.Domain$1.run(Domain.java:121)
at org.jboss.aop.Domain.getDomainName(Domain.java:119)
at com.hp.ws.business.session.WsSession$WsSessionAdvisor.initialise(WsSession$WsSessionAdvisor.java)
at com.hp.ws.business.session.WsSession$WsSessionAdvisor.(WsSession$WsSessionAdvisor.java)
at com.hp.ws.business.session.WsSession.(WsSession.java)
I am using jbosscache-pojo-3.0.0.GA and weblogic 11g
Any help is highly appreciated.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/722945#722945]
Start a new discussion in JBoss AOP at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months