This content has been marked as final.
Show 3 replies
-
1. Re: how to inject into components.xml?
v.masterov Jul 5, 2008 9:38 PM (in response to x490812)Could not you use this one ?:
#{serverInfo.webServerURL}
@Factory annotation is not required here... -
2. Re: how to inject into components.xml?
x490812 Jul 7, 2008 3:11 AM (in response to x490812)Have tried this already here is code
@Name("serverInfo") @Scope(ScopeType.APPLICATION) @Startup public class ServerInfo implements Serializable { private static final long serialVersionUID = 1L; String serverName = "Ukn."; // Unknown server name (short, for small // display) private String webServerURL = null; public ServerInfoTest() { try { InetAddress addr = InetAddress.getLocalHost(); serverName = addr.getHostName(); webServerURL = System.getProperty("CAM.Server.Url"); } catch (Exception e) { System.out.println(e.toString()); } } public String getServerName() { return this.serverName; } public String getWebServerURL(){ return webServerURL; } }
Here is the error
18:05:35,083 ERROR [STDERR] RuleAgent(default) INFO (Sun Jul 06 18:05:35 PDT 2008): Configuring with newInstance=false, secondsToRefresh=30 18:05:35,099 ERROR [STDERR] RuleAgent(default) INFO (Sun Jul 06 18:05:35 PDT 2008): Configuring package provider : URLScanner monitoring URLs: http://#{serverInfo.webServerURL}#{serverInfo.webServerURL}/drools-jbrms/org.drools.brms.JBRMS/package/com.homeq.cam.deal.domain.isDeal/LATEST with local cache dir of \var\data\cam 18:05:50,317 ERROR [STDERR] RuleAgent(default) WARNING (Sun Jul 06 18:05:50 PDT 2008): Was an error contacting http://#{serverInfo.webServerURL}#{serverInfo.webServerURL}/drools-jbrms/org.drools.brms.JBRMS/package/com.homeq.cam.deal.domain.isDeal/LATEST. Reponse header: {} 18:05:50,317 ERROR [STDERR] RuleAgent(default) EXCEPTION (Sun Jul 06 18:05:50 PDT 2008): Was unable to reach server.. Stack trace should follow. 18:05:50,317 ERROR [STDERR] java.io.IOException: Was unable to reach server. 18:05:50,317 ERROR [STDERR] at org.drools.agent.URLScanner.hasChanged(URLScanner.java:145) 18:05:50,317 ERROR [STDERR] at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109) 18:05:50,317 ERROR [STDERR] at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88) 18:05:50,317 ERROR [STDERR] at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330) 18:05:50,317 ERROR [STDERR] at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298) 18:05:50,317 ERROR [STDERR] at org.drools.agent.RuleAgent.configure(Ru . .
It seems interpolation is not happening as I have a breakpoint in the getWebServerURL function and it never gets in there during execution. In addition, I dont know why the duplication of the el expression, i.e., #{serverInfo.webServerURL}#{serverInfo.webServerURL}
Any Ideas???
-
3. Re: how to inject into components.xml?
x490812 Jul 7, 2008 3:13 AM (in response to x490812)Please ignore reference to serverInfoTest - it is actually correct as serverInfo